conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Refactor para funfar via linha de comando\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\nfrom atores import PassaroAmarelo, PassaroVermelho, Obstaculo, Porco\nfrom fase import Fase\nfrom placa_grafica_tkinter i...
python
chosen
[ { "from": "system", "value": "Change docs of send_message method\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nDeclaration of classes needed for bot working:\nAdapter class, Plugin class\n\n@author: Lises team\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\...
python
chosen
[ { "from": "system", "value": "Add register and IO addresses\n" }, { "from": "human", "value": "import re\nfrom pygments.lexer import RegexLexer, include\nfrom pygments.token import *\n\nclass HackAsmLexer(RegexLexer):\n name = 'Hack Assembler'\n aliases = ['hack_asm']\n filenames = ['*....
python
chosen
[ { "from": "system", "value": "Revert \"Textile is working with Python 3 now.\"\n\nThis reverts commit 849316dd5bffa9132608cc9eeac63b08188f31c0.\nTextile is still having issues with Python 3.2 so rollback the support until it\nis fixed.\n" }, { "from": "human", "value": "# Copyright (c) 2014, Mat...
python
chosen
[ { "from": "system", "value": "Use 11 as master_port_id for labs convenience.\n\nR=phajdan.jr@chromium.org \nBUG=449961\n\nReview URL: https://codereview.chromium.org/935813002\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@294106 0039d316-1c4b-4281-b951-d872f2087c98\n" }, { "from": "human",...
python
chosen
[ { "from": "system", "value": "Fix import post merge to project directory\n" }, { "from": "human", "value": "from scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor\nfrom scrapy.selector import Selector\nfrom dataset import DatasetIte...
python
chosen
[ { "from": "system", "value": "Remove typ filter from dashboard\n" }, { "from": "human", "value": "import django_filters\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom adhocracy4.filters import widgets as filters_widgets\nfrom adhocracy4.filters.filters import DefaultsFilterSet\...
python
chosen
[ { "from": "system", "value": "Add all_nodes and growing times param\n" }, { "from": "human", "value": "class GrowingGraph:\n def __init__(self, neighbors_table, start_nodes):\n self.neighbors_table = neighbors_table\n self.outer_nodes = set(start_nodes)\n self.inner_nodes...
python
chosen
[ { "from": "system", "value": "Use servers for craq that are actually alive.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport subprocess\nimport time\nimport socket\n\ndef main():\n if (not socket.gethostname() in ['meru28', 'meru29', 'meru30']):\n retu...
python
chosen
[ { "from": "system", "value": "Implement __getattr__ to reduce code\n" }, { "from": "human", "value": "class SpaceAge(object):\n def __init__(self, seconds):\n self.seconds = seconds\n\n @property\n def years(self):\n return self.seconds/31557600\n\n def on_earth(self):\...
python
chosen
[ { "from": "system", "value": "Use WxApplication as base class for the scanner\n" }, { "from": "human", "value": "from Cura.Application import Application\n\nclass ScannerApplication(Application):\n def __init__(self):\n super(ScannerApplication, self).__init__()\n \n self...
python
chosen
[ { "from": "system", "value": "Add a todo item to run()\n" }, { "from": "human", "value": "import argparse\nimport importlib\nimport logging\nimport os\n\nlogger = logging.getLogger(__name__)\n\ndescription = \"An automated grading tool for programming assignments.\"\n\nsubcommands = {\n \"ini...
python
chosen
[ { "from": "system", "value": "Add docstring explaiing why to take the second description\n" }, { "from": "human", "value": "'''\nHarvester for the DataCite MDS for the SHARE project\n\nExample API call: http://oai.datacite.org/oai?verb=ListRecords&metadataPrefix=oai_dc\n'''\nfrom __future__ impo...
python
chosen
[ { "from": "system", "value": "Remove unused constant for topics\n\nWhile reading the code, I found \"L3_AGENT\" topic is defined\nbut never be used.\n\nChange-Id: I9b6da61f9fe5224d2c25bbe7cc55fd508b4e240f\n" }, { "from": "human", "value": "# Copyright 2015 Cisco Systems, Inc\n# All Rights Reserv...
python
chosen
[ { "from": "system", "value": "Remove Telemetry.__init__ as not necessary\n" }, { "from": "human", "value": "from tsserver import db\nfrom tsserver.dtutils import datetime_to_str\n\n\nclass Telemetry(db.Model):\n \"\"\"\n All the data that is going to be obtained in regular time intervals\n...
python
chosen
[ { "from": "system", "value": "Refactor SimpleSectionView to inherit DetailView" }, { "from": "human", "value": "from django.core.exceptions import ImproperlyConfigured\nfrom django.core.urlresolvers import reverse\nfrom django.views.generic import TemplateView\nfrom django.utils.translation impo...
python
chosen
[ { "from": "system", "value": "Add reconstruct corpus as a test\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport argparse\nimport collections\nimport random\n\nimport sys\n\n\ndef reconstruct(f_in, f_out):\n sentence_starts = []\n\n contexts = {}\n\n for line in f_in:\...
python
chosen
[ { "from": "system", "value": "Increment minor version number ahead of release" }, { "from": "human", "value": "\"\"\"Main initialisation for extension.\"\"\"\n\nVERSION = (0, 4, 1)\n__version__ = '.'.join(map(str, VERSION))\n\n\ntry:\n from geokey.extensions.base import register\n\n regist...
python
chosen
[ { "from": "system", "value": "Write a function covert far to cesis\n" }, { "from": "human", "value": "def k_to_c(temp):\n\treturn temp - 273.15\n\ndef f_to_k(temp):\n\treturn ((temp - 32) * (5 / 9)) + 273.15\n" }, { "from": "gpt", "value": "def k_to_c(temp):\n\treturn temp - 273.15\n...
python
chosen
[ { "from": "system", "value": "Remove sleep time as it appeared to hang forever\n" }, { "from": "human", "value": "import sys\nimport time\nimport asyncio\nimport logging\n\ndef pg_lsn_to_int(pos):\n # http://www.postgresql.org/docs/9.4/static/datatype-pg-lsn.html\n # see http://eulerto.blo...
python
chosen
[ { "from": "system", "value": "Use a bigger volume so it doesn't fill up\n" }, { "from": "human", "value": "# Creates an EBS volume for the index and attaches it to a given instance as /dev/xvdf.\n# Prints the volume ID on stdout.\n# Usage: attach-index-volume.py <channel> <instance-id>\n\nimport...
python
chosen
[ { "from": "system", "value": "Comment out known failing test for now (code not in prod).\n" }, { "from": "human", "value": "from django.test import TestCase\nfrom core import hacks\n\nclass TestHacks(TestCase):\n fixtures = ['eric.json', 'test_data.json']\n\n def setUp(self):\n hack...
python
chosen
[ { "from": "system", "value": "Fix typo in resource media path\n" }, { "from": "human", "value": "\"\"\"Helper functions for determining file paths for uploads.\"\"\"\n\nfrom os.path import join\nfrom datetime import datetime\nfrom pytz import timezone\n\n# This is duplicated here to avoid circul...
python
chosen
[ { "from": "human", "value": "Test running `bokeh` with no subcommand\n" }, { "from": "gpt", "value": "import pytest\n\nfrom bokeh.command.bootstrap import main\n\ndef test_no_subcommand(capsys):\n with pytest.raises(SystemExit):\n main([\"bokeh\"])\n out, err = capsys.readouterr()\n...
python
chosen
[ { "from": "system", "value": "Add test for error check\n" }, { "from": "human", "value": "import pytest\nfrom poliastro.twobody.mean_elements import get_mean_elements\n\ndef test_get_mean_elements_raises_error_if_invalid_body():\n body = \"Sun\"\n\n with pytest.raises(ValueError) as excinf...
python
chosen
[ { "from": "system", "value": "Fix the order of importing\n" }, { "from": "human", "value": "from chainer.training.triggers import interval_trigger # NOQA\nfrom chainer.training.triggers import minmax_value_trigger # NOQA\n\n\n# import class and function\nfrom chainer.training.triggers.interval...
python
chosen
[ { "from": "system", "value": "Set version to mercurial in trunk\n" }, { "from": "human", "value": "# The MIT License\n#\n# Copyright (c) 2008 Bob Farrell\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": "Add an additional default redirect_uri\n\n(runserver's default port)\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.3 on 2017-07-26 20:29\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations\nfrom oauth...
python
chosen
[ { "from": "system", "value": "Add support key for Travis LINT check\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\r\n# © 2015 Elico corp (www.elico-corp.com)\r\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\r\n{\r\n 'name': 'Timesheet Activities Report',\r\...
python
chosen
[ { "from": "system", "value": "Handle non existing data files in BaseParser.\n" }, { "from": "human", "value": "from os import path\n\nimport linkedin_scraper\n\n\nclass BaseParser:\n @staticmethod\n def get_data_dir():\n return path.abspath(path.join(linkedin_scraper.__file__,\n ...
python
chosen
[ { "from": "system", "value": "Change ImagerProfile model privacy booleans to default of False, profile_picture to nullable\n" }, { "from": "human", "value": "from django.db import models\n# from django.conf import settings\n\n# Create your models here.\n\n\nclass ImagerProfile(models.Model):\n\n...
python
chosen
[ { "from": "system", "value": "Create MetaCaching, ModelBase for core cache\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.db import models\n\n\nclass ModelCaching(models.Model):\n pass\n" }, { "from": "gpt", "value": "#!/usr/bin/env ...
python
chosen
[ { "from": "system", "value": "Add tests for planner init\n" }, { "from": "human", "value": "import cutplanner\nimport unittest\n\nclass TestPlanner(unittest.TestCase):\n\n def setUp(self):\n sizes = [50, 80, 120]\n needed = [10, 25, 75]\n loss = 0.25\n self.planner...
python
chosen
[ { "from": "system", "value": "migrations: Fix deactivated realm corner cases with 0108.\n\nPreviously the default-string-id migration would not correctly handle\nignoring deactivated realms.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.11.4 on 2017-08-24 02...
python
chosen
[ { "from": "system", "value": "Add aww_incentive report view to migration util\n" }, { "from": "human", "value": "from __future__ import absolute_import\nfrom __future__ import unicode_literals\n\nfrom corehq.sql_db.operations import RawSQLMigration\n\n\ndef get_view_migrations():\n sql_views ...
python
chosen
[ { "from": "system", "value": "Add view for the events modules\n" }, { "from": "human", "value": "# This file is part of Indico.\n# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).\n#\n# Indico is free software; you can redistribute it and/or\n# modify it under the ter...
python
chosen
[ { "from": "system", "value": "Remove TODO - complete as of last commit\n\nSeason object is passed to the table update\n" }, { "from": "human", "value": "import requests\nfrom nflpool.data.dbsession import DbSessionFactory\nfrom nflpool.data.activeplayers import ActiveNFLPlayers\nimport nflpool.d...
python
chosen
[ { "from": "system", "value": "Fix a small release bug\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nCore Tinman imports\n\"\"\"\n__author__ = 'Gavin M. Roy'\n__email__ = '<gmr@myyearbook.com>'\n__since__ = '2011-03-14'\n__version__ = \"0.2.5\n\n__all__ = ['tinman.application'...
python
chosen
[ { "from": "system", "value": "Support for python3.5 has been added for configparser\n" }, { "from": "human", "value": "# Copyright 2017 <thenakliman@gmail.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the Licen...
python
chosen
[ { "from": "system", "value": "Add more objects to the default namespace.\n\nEase of testing, I'm not exactly a fan of polluting it though. Might rework\nthis later.\n" }, { "from": "human", "value": "\"\"\"\ngithub3\n=======\n\nSee http://github3py.rtfd.org/ for documentation.\n\n:copyright: (c)...
python
chosen
[ { "from": "system", "value": "Allow string IDs in get_by_id.\n" }, { "from": "human", "value": "from google.appengine.ext import db\n\nclass Recipe(db.Model):\n title = db.StringProperty(required=True)\n text = db.TextProperty()\n ingredients = db.TextProperty()\n tags = db.StringLis...
python
chosen
[ { "from": "system", "value": "Fix flake8 issues in field example\n" }, { "from": "human", "value": "import graphene\n\nclass Person(graphene.Interface):\n name = graphene.String()\n age = graphene.ID()\n\nclass Patron(Person):\n id = graphene.ID()\n\nclass Query(graphene.ObjectType):\n\...
python
chosen
[ { "from": "system", "value": "Exclude the salt from the returned decrypted password\n" }, { "from": "human", "value": "from Crypto.Cipher import Blowfish\nfrom django.conf import settings\nfrom random import choice\nfrom base64 import encodestring as encode\nfrom base64 import decodestring as de...
python
chosen
[ { "from": "system", "value": "Convert test case to Python unittest.TestCase\n\nUse Python's testing framework\n\nChange-Id: I924f329c43294bb1fbb395a7bb19bcaf06ea9385\n" }, { "from": "human", "value": "import molequeue\n\nclient = molequeue.Client()\nclient.connect_to_server('MoleQueue')\n\njob_r...
python
chosen
[ { "from": "system", "value": "Remove some nasty imports to avoid cyclic import issues.\n" }, { "from": "human", "value": "# Licensed to the StackStorm, Inc ('StackStorm') under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional inform...
python
chosen
[ { "from": "system", "value": "Integrate whitenoise with the Django application\n\nThis allows Django to serve static files in production.\n" }, { "from": "human", "value": "\"\"\"\nWSGI config for craigomatic project.\n\nIt exposes the WSGI callable as a module-level variable named ``application...
python
chosen
[ { "from": "system", "value": "Write date format in header.\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport pyaavso\n\n\nclass VisualFormatWriter(object):\n \"\"\"\n A class responsible for writing observation data in AAVSO\n `Visual File Format`_.\n\...
python
chosen
[ { "from": "system", "value": "Add test to ensure only one conn object is created\n" }, { "from": "human", "value": "# coding: utf-8\nfrom pysuru.base import BaseAPI, ObjectMixin\n\n\ndef test_baseapi_headers_should_return_authorization_header():\n api = BaseAPI(None, 'TOKEN')\n assert {'Au...
python
chosen
[ { "from": "system", "value": "Use a separate log file for the public launcher data\n\nLog files are not thread-safe\n" }, { "from": "human", "value": "import json\nimport logging\nimport argparse\nimport numpy as np\n\nimport emission.pipeline.scheduler as eps\n\nif __name__ == '__main__':\n ...
python
chosen
[ { "from": "system", "value": "Make craq router script point at correct zookeeper node.\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport sys\nimport subprocess\nimport time\n\ndef main():\n\tsubprocess.Popen('/home/meru/bmistree/new-craq-dist/craq-router-32 -d meru -p 10499 -z 192.1...
python
chosen
[ { "from": "system", "value": "Make realtim fco bucket names match format of others\n" }, { "from": "human", "value": "\"\"\"\nAdd capped collections for real time data\n\"\"\"\nimport logging\n\nlog = logging.getLogger(__name__)\n\n\ndef up(db):\n capped_collections = [\n \"fco_realtim...
python
chosen
[ { "from": "system", "value": "io: Move plugin tests to io/tests.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom scikits.image._build import cython\n\nimport os.path\n\nbase_path = os.path.abspath(os.path.dirname(__file__))\n\ndef configuration(parent_package='', top_path=None):...
python
chosen
[ { "from": "system", "value": "Fix typo in sandbox attribute name.\n" }, { "from": "human", "value": "import logging\n\nlogger = logging.getLogger(__name__)\n\n# Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox\nallowable_sandbox_tokens = set(\n [\n ...
python
chosen
[ { "from": "system", "value": "Format short durations without \"0 hours\"\n" }, { "from": "human", "value": "from datetime import time\n\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext as _\nfrom django import template\n\n\nregister = template.Library...
python
chosen
[ { "from": "system", "value": "Add the license block and BaseConnection\n" }, { "from": "human", "value": "from asyncore_connection import AsyncoreConnection\nfrom blocking_connection import BlockingConnection\nfrom tornado_connection import TornadoConnection\n" }, { "from": "gpt", "v...
python
chosen
[ { "from": "system", "value": "Move the pylint message and fix comment length\n" }, { "from": "human", "value": "# Copyright 2018 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance ...
python
chosen
[ { "from": "system", "value": "Set level on module logger instead\n" }, { "from": "human", "value": "import logging\nimport warnings\n\nwarnings.filterwarnings(\"ignore\")\n\n\n###\n# REVIEWER NOTE: THE ORIGINAL IMPLEMENTATION WAS HEAVY HANDED AND I BELIEVE WAS A TEMPORARY WORKAROUND.\n# PLEASE C...
python
chosen
[ { "from": "system", "value": "Integrate tests of prepared geoms into main test suite.\n\ngit-svn-id: 1a8067f95329a7fca9bad502d13a880b95ac544b@1508 b426a367-1105-0410-b9ff-cdf4ab011145\n" }, { "from": "human", "value": "# package\nfrom test_doctests import test_suite\n" }, { "from": "gpt"...
python
chosen
[ { "from": "system", "value": "Fix config to use yunity_swagger\n" }, { "from": "human", "value": "\"\"\"wuppdays URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https://docs.djangoproject.com/en/1.8/topics/http/urls/\nExamples:\nFunction vi...
python
chosen
[ { "from": "system", "value": "Add file path existince checking\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nimport json\nimport click\nfrom wensleydale import parser\n\n\n@click.command()\n@click.argument('path', type...
python
chosen
[ { "from": "system", "value": "Add a basic ast translator\n" }, { "from": "human", "value": "from ast import AST\nimport yaml\n\n\nclass ASTTranslator:\n\n def __init__(self, tree):\n self.tree = tree\n\n def translate(self):\n return yaml.dump({'type': 'program', 'code': []})...
python
chosen
[ { "from": "system", "value": "Fix privledged page constant for TI-83+\n\nThis closes https://github.com/KnightOS/KnightOS/issues/265\n" }, { "from": "human", "value": "import os\nimport requests\nfrom sys import stderr, exit\nfrom resources import get_resource_root\n\ndef get_key(platform):\n ...
python
chosen
[ { "from": "system", "value": "Revert \"Update manager for Person requirement\"\n\nThis reverts commit 1f7c21280b7135f026f1ff807ffc50c97587f6fd.\n" }, { "from": "human", "value": "# Django\nfrom django.contrib.auth.models import BaseUserManager\n\n\nclass UserManager(BaseUserManager):\n\n def ...
python
chosen
[ { "from": "system", "value": "Add draft of printf in python\n" }, { "from": "human", "value": "# This is a documentation block with several lines\n# so I can test how it works.\n\nimport cv2\n\ndef main():\n print(\"cvui main\");\n\nif __name__ == '__main__':\n main()\n\ndef random_numbe...
python
chosen
[ { "from": "system", "value": "Test fewer dts, only test implicit methods.\n\nThe timesteps used here are not valid for explicit methods.\n" }, { "from": "human", "value": "import os\nimport csv\nfrom collections import deque\n\nimport matplotlib\nimport numpy as np\nimport matplotlib.pyplot as p...
python
chosen
[ { "from": "system", "value": "Change tasks key prefix to jobs.duration\n" }, { "from": "human", "value": "\"\"\"\nsentry.tasks.base\n~~~~~~~~~~~~~~~~~\n\n:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.\n:license: BSD, see LICENSE for more details.\n\"\"\"\n\nfrom cele...
python
chosen
[ { "from": "system", "value": "Create template tag image obj on images\nreceive obj image\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django import template\nfrom ..generate import image_url as url\n\n\nregister = template.Library()\n\n\n@register.simpl...
python
chosen
[ { "from": "system", "value": "Update sounds list data view\n" }, { "from": "human", "value": "from flask import Flask, request, jsonify, send_from_directory\nimport os\nimport uuid\napp = Flask(__name__)\nUPLOAD_FOLDER = \"uploads/\"\n\n@app.route(\"/\")\ndef index():\n return send_from_direc...
python
chosen
[ { "from": "system", "value": "Change isinstance check to duck typing because this is Python lol\n" }, { "from": "human", "value": "from discord.ext.commands import Bot, CommandInvokeError\r\nfrom discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument\r\n\r\nclass BeattieBot(...
python
chosen
[ { "from": "system", "value": "Load the lan config from a json file\n" }, { "from": "human", "value": "#main/contexts.py\nfrom django.core.urlresolvers import resolve\n\nfrom cl_module.cl_module import ModuleManager\nfrom flags.registry import get_flag_registry\nfrom pyalp.skin import get_skin\n\...
python
chosen
[ { "from": "system", "value": "Fix in port number initialisation\n" }, { "from": "human", "value": "\nfrom os import getenv\nfrom webapp import create_app\nfrom argparse import ArgumentParser\n\n\napp = create_app(getenv('FLASK_CONFIG') or 'development')\n\n\ndef main():\n parser = ArgumentPar...
python
chosen
[ { "from": "system", "value": "Extend script to test binary commands\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport socket\n\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ns.connect((\"localhost\", 5001))\ns.send(\"imei:123456789012345,tracker,151030080103,,F,000101.000,A...
python
chosen
[ { "from": "system", "value": "MAINT: Fix invalid parameter types used in `Dtype`\n" }, { "from": "human", "value": "\"\"\"\nThis file defines the types for type annotations.\n\nThese names aren't part of the module namespace, but they are used in the\nannotations in the function signatures. The ...
python
chosen
[ { "from": "system", "value": "Remove unnecessary printing of JSON in log\n" }, { "from": "human", "value": "from flask import Flask, render_template\nfrom parser import Parser\nimport json\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n parser = Parser()\n data = parser.parse_a...
python
chosen
[ { "from": "system", "value": "Update TODO for other definitions" }, { "from": "human", "value": "from os.path import dirname, join\n\nimport pandas as pd\n\n_dtrm = pd.read_csv(join(dirname(__file__), \"magicc_dattype_regionmode_regions.csv\"))\n\nregion_cols = _dtrm.columns.to_series().apply(la...
python
chosen
[ { "from": "system", "value": "Add url corresponding to the added view\n" }, { "from": "human", "value": "from django.conf.urls import patterns, url\n\n\nurlpatterns = patterns('projects.views',\n url(r'^add/$', 'add_project', name='add_project'),\n url(r'^edit/(?P<project_id>.*)/$', 'edit_...
python
chosen
[ { "from": "system", "value": "Add tests for lines with both a count and percentage\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nimport pytest\nimport sys\n\n# This line allows the tests to run if you just naively run this script.\n# But the preferred way is to use run_tests.sh\ns...
python
chosen
[ { "from": "system", "value": "Use query parameters through the python library" }, { "from": "human", "value": "import unittest\nimport http.client\n\nclass TestStringMethods(unittest.TestCase):\n\n def test_404NoConfig(self):\n connRouter = http.client.HTTPConnection(\"localhost\", 866...
python
chosen
[ { "from": "system", "value": "Remove name field. It already exists\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nimport django.db.models.deletion\n\n\nclass Migration(migrations.Migration):\n\n ...
python
chosen
[ { "from": "system", "value": "Copy used assets to output path\n" }, { "from": "human", "value": "import konstrukteur.Konstrukteur\nimport jasy.asset.Manager2 as AssetManager\n\n@task\ndef build(regenerate = False):\n\t\"\"\"Generate source (development) version\"\"\"\n\n\t# Initialize assets\n\t...
python
chosen
[ { "from": "system", "value": "Fix test to use new optimizer interface\n\nSigned-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com>\n" }, { "from": "human", "value": "\"\"\"Test suite for optimizers.constant.\"\"\"\n\nfrom __future__ import division\nfrom __future__ import ...
python
chosen
[ { "from": "system", "value": "Remove JSON serialization usages (PY-16388, PY-16389)\n" }, { "from": "human", "value": "import sys\n\nIS_PY3K = False\n\ntry:\n if sys.version_info[0] >= 3:\n IS_PY3K = True\nexcept AttributeError:\n pass #Not all versions have sys.version_info\n\n\ni...
python
chosen
[ { "from": "system", "value": "Add URLs to each searializer\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom .models import ContentItem, Profile, Comment, Hashtag, ContentHashTag, Like\nfrom rest_framework import serializers\n\n\nclass UserSerializer(serializer...
python
chosen
[ { "from": "system", "value": "Change memcache expiration timing to 1 week\n" }, { "from": "human", "value": "__author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith'\n\nfrom BaseHandler import *\nimport logging\nfrom XMLAnalyser import XMLAnalyser\nfrom google.appengine.api import memcache\n\nc...
python
chosen
[ { "from": "system", "value": "Remove WKPB from geosearch - also change other test\n" }, { "from": "human", "value": "import unittest\n\nfrom datapunt_geosearch import config\nfrom datapunt_geosearch import datasource\n\n\nclass TestBAGDataset(unittest.TestCase):\n def test_query(self):\n ...
python
chosen
[ { "from": "system", "value": "Use a chord in order to start tasks\n" }, { "from": "human", "value": "import os\nimport json\n\nimport requests\nimport rethinkdb as r\n\nfrom flask import Blueprint, current_app\n\nfrom utils.decorators import validate, require\nfrom utils.validators import valida...
python
chosen
[ { "from": "system", "value": "Fix build with Sphinx 4.\n\n`add_stylesheet` was deprecated in 1.8 and removed in 4.0 [1]. The\nreplacement, `add_css_file` was added in 1.0, which is older than any\nversion required by `breathe`.\n\n[1] https://www.sphinx-doc.org/en/master/extdev/deprecated.html?highlight=add...
python
chosen
[ { "from": "system", "value": "Add couple more utils tests.\n" }, { "from": "human", "value": "from __future__ import division\nfrom utils import absolute_magnitude, plDensity, hz\n\n\ndef test_absolute_magnitude():\n m = 10\n assert isinstance(absolute_magnitude(1, 1), float)\n assert a...
python
chosen
[ { "from": "system", "value": "Fix typo broke trig program\n" }, { "from": "human", "value": "from flask import render_template, request, Blueprint\nimport json\n\nfrom app.state import state\n\n\nPROGRAMS_LIST = [\n [\"ascii_text\", \"ASCII Text\"],\n [\"cheertree\", \"Cheertree...
python
chosen
[ { "from": "system", "value": "Allow specifying a port to actually work\n" }, { "from": "human", "value": "from zope.interface import implements\n\nfrom twisted.plugin import IPlugin\nfrom twisted.application.service import IServiceMaker\nfrom twisted.application import internet\n\nfrom oauth_pro...
python
chosen
[ { "from": "system", "value": "Add option for launching server\n\nThere was no option to start the server and you had to do it manually.\nNow it can be started with:\n\t1) -s with default configuration\n\t2) --server <PORT> for manual port choice\n" }, { "from": "human", "value": "import argparse...
python
chosen
[ { "from": "system", "value": "Remove last slash from file path\n" }, { "from": "human", "value": "from Measurement import Measurement\n\nclass Recorder(object):\n def __init__(self, recorderType):\n self.recorderType = recorderType\n\n def record(self, measure: Measurement):\n ...
python
chosen
[ { "from": "system", "value": "Add test generator for function complexity\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os.path\nimport nose.tools as nose\nimport pep8\n\n\ndef test_pep8():\n '''all Python files should comply with PEP 8'''\n for subdir_path, subdir_name...
python
chosen
[ { "from": "system", "value": "Add test case for when git is not available\n" }, { "from": "human", "value": "import pytest\n\nfrom lektor.quickstart import get_default_author\nfrom lektor.quickstart import get_default_author_email\nfrom lektor.utils import locate_executable\n\n\ndef test_default...
python
chosen
[ { "from": "system", "value": "Rename 'config' service to 'options'\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nimport gevent\nimport gevent.wsgi\nimport simplejson as json\n\nfrom butler import service\nfrom butler.o...
python
chosen
[ { "from": "system", "value": "Fix tests for udata/datagouvfr backend\n" }, { "from": "human", "value": "import json\n\nfrom six.moves.urllib_parse import urlencode\n\nfrom .oauth import OAuth2Test\n\n\nclass DatagouvfrOAuth2Test(OAuth2Test):\n backend_path = 'social_core.backends.udata.Datago...
python
chosen
[ { "from": "system", "value": "Add a presubmit script that runs pylint in catapult/dashboard.\n\nAlso, resolve current issues in catapult/dashboard that pylint warns about. (Note: these were also resolved in cl/95586698.)\n\nReview URL: https://codereview.chromium.org/1188483002\n" }, { "from": "huma...
python
chosen
[ { "from": "system", "value": "Switch to requests for checking if links are valid.\n\nThis should have the side effect of not caring about invalid SSL certs, for\nhttps://unisubs.sifterapp.com/projects/12298/issues/557501/comments\n" }, { "from": "human", "value": "import httplib2\n\ndef url_exis...
python
chosen
[ { "from": "system", "value": "Remove collecting plugins every second\n" }, { "from": "human", "value": "import os\n\nimport telegram\n\nfrom leonard import Leonard\n\nif __name__ == '__main__':\n os.chdir('../')\n telegram_client = telegram.Bot(os.environ['BOT_TOKEN'])\n bot = Leonard(t...
python
chosen
[ { "from": "system", "value": "Enable mutable config in searchlight\n\nNew releases of oslo.config support a 'mutable' parameter to Opts.\noslo.service provides an option here Icec3e664f3fe72614e373b2938e8dee53cf8bc5e\nallows services to tell oslo.service they want mutate_config_files to be\ncalled by passin...
python
chosen