conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add -T option to list available targets\n" }, { "from": "human", "value": "from .config import parse\nfrom .target import Target\nfrom .__version__ import __version__\n\nfrom argparse import ArgumentParser\n\nimport logging\nimport os\nimport sys\n\n\ndef main():\n ...
python
chosen
[ { "from": "system", "value": "Test the presence of various tools\n" }, { "from": "human", "value": "\"\"\"\nCore tests. Test general environment.\n\"\"\"\n\nimport subprocess as sp\nfrom django.test import TestCase\nfrom django.test.client import Client\nfrom django.contrib.auth.models import U...
python
chosen
[ { "from": "system", "value": "Return object not array when requesting single district/station\n\nIf we are requesting a single polling station or district\nreturn an object instead of an array with length 1\n" }, { "from": "human", "value": "from rest_framework.decorators import list_route\nfrom...
python
chosen
[ { "from": "system", "value": "Correct start date for \"Samtull\"\n" }, { "from": "human", "value": "# encoding: utf-8\n\nfrom comics.aggregator.crawler import NettserierCrawlerBase\nfrom comics.core.comic_data import ComicDataBase\n\n\nclass ComicData(ComicDataBase):\n name = \"Samtull\"\n ...
python
chosen
[ { "from": "system", "value": "Set EAV form class name to match EAV model name\n\n(for easier debugging, at least in theory)\n" }, { "from": "human", "value": "from django import forms\nfrom django.core.exceptions import ValidationError\n\nfrom cyder.base.eav.constants import ATTRIBUTE_TYPES\nfro...
python
chosen
[ { "from": "system", "value": "[FIX] module_auto_update: Rollback cursor if param exists\n\nWithout this patch, when upgrading after you have stored the deprecated features parameter, the cursor became broken and no more migrations could happen. You got this error:\n\n Traceback (most recent call last):\n...
python
chosen
[ { "from": "system", "value": "Update ALLOWED_HOSTS for move to service domain\n" }, { "from": "human", "value": "from .base import *\nimport os\n\n\nDEBUG = False\nTEMPLATE_DEBUG = DEBUG\n\nGOOGLE_ANALYTICS_ID = \"UA-53811587-1\"\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.b...
python
chosen
[ { "from": "system", "value": "Set config logging in init to debug\n" }, { "from": "human", "value": "import os\nfrom flask import Flask\nimport logging\nfrom raven.contrib.flask import Sentry\n\n\nfrom themint.health import Health\n\n\napp = Flask(__name__)\n\napp.config.from_object(os.environ.g...
python
chosen
[ { "from": "system", "value": "Handle when N/A comes thru the quote.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\"\"\"Display stock quotes on LCD\"\"\"\n\nimport ystockquote as y\nfrom lcd import lcd_string, tn\n\nsymbols = ['AAPL', 'MSFT', 'F', 'T', 'KO', 'GOOG', 'SYK', 'DIS', '...
python
chosen
[ { "from": "system", "value": "Move template functions out of `Config.load()`\n" }, { "from": "human", "value": "import os\nimport yaml\n\nfrom subprocess import check_output, CalledProcessError\nfrom colors import red\nfrom jinja2 import Template\n\n\nclass Config():\n\n @staticmethod\n de...
python
chosen
[ { "from": "system", "value": "[REF] openacademy: Modify copy method into inherit\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom openerp import fields, models\n\n'''\nThis module create model of Course\n'''\n\n\nclass Course(models.Model):\n '''\n This class create model...
python
chosen
[ { "from": "system", "value": "Add 24 hour waiting time for removing phone number after reservation\n" }, { "from": "human", "value": "from datetime import datetime\n\nfrom django import forms\n\nfrom news.forms import MaterialFileWidget\n\nfrom .models import Profile\n\n\nclass ProfileSearchForm...
python
chosen
[ { "from": "system", "value": "Add array submodule to standard import\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"All SPARE-ICE related modules.\"\"\"\n\nfrom typhon.spareice.collocations import * # noqa\nfrom typhon.spareice.common import * # noqa\nfrom typhon.spareice....
python
chosen
[ { "from": "system", "value": "Add UKRDC_PATIENT_SEARCH_URL to test app config\n" }, { "from": "human", "value": "import string\nimport random\n\nimport pytest\n\nfrom radar_api.app import create_app\nfrom radar.database import db\n\n\n@pytest.fixture(scope='session')\ndef app():\n return crea...
python
chosen
[ { "from": "system", "value": "Implement HTTP caching when CLI option is set\n" }, { "from": "human", "value": "import os\n\nfrom whack.caching import DirectoryCacher, NoCachingStrategy\nimport whack.builder\n\ndef install(package, install_dir, caching, builder_uris, params):\n if caching.enab...
python
chosen
[ { "from": "system", "value": "Add docstring, change tables searched\n" }, { "from": "human", "value": "#! /usr/bin/env python\n\nimport MapGardening\nimport optparse\n\nusage = \"usage: %prog [options]\"\np = optparse.OptionParser(usage)\np.add_option('--place', '-p',\n default=\"all...
python
chosen
[ { "from": "system", "value": "Use proper import from utils\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.test import TestCase\n\nfrom modeltrans.manager import (split_translated_fieldname,\n trans...
python
chosen
[ { "from": "system", "value": "Replace star imports to fix mypy issue.\n" }, { "from": "human", "value": "from .qsim_circuit import *\nfrom .qsim_simulator import *\nfrom .qsimh_simulator import *\n\n\n" }, { "from": "gpt", "value": "from .qsim_circuit import add_op_to_opstring, add_o...
python
chosen
[ { "from": "system", "value": "Add NOUGAT version code constant.\n\nReview-Url: https://codereview.chromium.org/2386453002\n" }, { "from": "human", "value": "# Copyright 2015 The Chromium Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style license that can be\n# fo...
python
chosen
[ { "from": "system", "value": "Use tclsh. Old habits die hard :)\n" }, { "from": "human", "value": "#!/usr/bin/python\n\nimport os\nimport re\nimport commands\n\nsuccessRE = re.compile(\"Hello, GitHub!\")\n\ntestsPassed = 0\n\n# Add more tests here\ntests = [\n\t\t \"bin/hello_c\",\n\t\t \"bin/h...
python
chosen
[ { "from": "system", "value": "Fix shape unpacking ((height, width), not (w, h)).\n" }, { "from": "human", "value": "\"\"\"\n=================\nTemplate Matching\n=================\n\nIn this example, we use template matching to identify the occurrence of an\nimage patch (in this case, a sub-imag...
python
chosen
[ { "from": "system", "value": "Return a `patterns` rather than a list of tuples\n" }, { "from": "human", "value": "from django.conf.urls import patterns\nfrom djproxy.views import HttpProxy\n\n\ndef generate_routes(config):\n routes = []\n for service_name, proxy_config in config.items():\n...
python
chosen
[ { "from": "system", "value": "Add necessary params to Experiment.\n" }, { "from": "human", "value": "class Experiment(object):\n def __init__(self, epochs=1):\n self.epochs = epochs\n\n def get_epochs(self):\n return self.epochs\n\n def train(self):\n raise NotImple...
python
chosen
[ { "from": "system", "value": "Remove potential duplicate registration code\n\nWas sometimes causing an error when importing the project\n" }, { "from": "human", "value": "\nbl_info = {\n 'name': \"Import: .EDM model files\",\n 'description': \"Importing of .EDM model files\",\n 'author': \"Ni...
python
chosen
[ { "from": "system", "value": "Move version num to own line" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# vim: sw=4:ts=4:expandtab\n\n\"\"\"\nckanny\n~~~~~~\n\nMiscellaneous CKAN utility scripts\n\nExamples:\n literal blocks::\n\n python example_google.py\n\nAttributes:\n ...
python
chosen
[ { "from": "system", "value": "Revert config-loading change in embedding example.\n" }, { "from": "human", "value": "import os\n\nfrom IPython.qt.console.qtconsoleapp import IPythonQtConsoleApp\nfrom IPython.qt.console.rich_ipython_widget import RichIPythonWidget\nfrom IPython.qt.inprocess import...
python
chosen
[ { "from": "system", "value": "Add test checking board can't get overfilled.\n" }, { "from": "human", "value": "from board import Board\n\ndef test_constructor():\n board = Board(0,0)\n assert board.boardMatrix.size == 0\n assert board.columns == 0\n assert board.rows == 0\n\n boar...
python
chosen
[ { "from": "system", "value": "Implement a __getattr__() for mock_wrapper that just returns a lambda that records whatever call was attempted along with the call params." }, { "from": "human", "value": "'''Unit test package for package \"tws\".'''\n\n__copyright__ = \"Copyright (c) 2008 Kevin J B...
python
chosen
[ { "from": "system", "value": "Fix path to .sql files\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nCustom managers for working with CAL-ACCESS processed data models.\n\"\"\"\nfrom __future__ import unicode_literals\nimport os\nfrom django.db import mo...
python
chosen
[ { "from": "system", "value": "Refactor build and print method\n" }, { "from": "human", "value": "from ListNode import *\n\n\nclass Solution():\n def addTwoNumbers(self, l1, l2):\n current_node = ListNode(None)\n head_node = current_node\n carry = 0\n p = l1\n ...
python
chosen
[ { "from": "system", "value": "Make sure prod.py is read in settings\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import print_function\n\n# Standard Library\nimport sys\n\nif \"test\" in sys.argv:\n print(\"\\033[1;91mNo django tests.\\033[0m\")\n print(\"Try...
python
chosen
[ { "from": "system", "value": "Revert \"Don't make dirs on startup\"\n\nThis reverts commit 17243b31fc6c8d8f4bb0dc7e11e2601800e80bb0.\n" }, { "from": "human", "value": "import os\nfrom decimal import Decimal\n\nfrom pockets.autolog import log\n\nfrom uber._version import __version__ # noqa: F401...
python
chosen
[ { "from": "system", "value": "Change inline docs about class fake storage variable\n\nAdjust the docs to better describe why a fake storage\nclass attribute exists and how it is used and what it\nrepresents compared to a real zookeeper setup.\n\nChange-Id: I255ccd83c8033266e9cee09a343468ae4e0f2bfd\n" }, ...
python
chosen
[ { "from": "system", "value": "Ch23: Remove password from UserAdmin fieldsets.\n" }, { "from": "human", "value": "from django.contrib import admin\n\nfrom .models import User\n\n\n@admin.register(User)\nclass UserAdmin(admin.ModelAdmin):\n # list view\n list_display = (\n 'get_name',...
python
chosen
[ { "from": "system", "value": "Fix user_profile index page url-pattern\n" }, { "from": "human", "value": "from django.conf.urls import include, url\nfrom django.contrib import admin\n\nfrom . import views\n\nurlpatterns = [\n url(r'^', views.ViewView.as_view(), name='profile_own_view'),\n u...
python
chosen
[ { "from": "system", "value": "Refactor send_message to remove completion block\n" }, { "from": "human", "value": "from http_client import HttpClient\n \nfrom models.message import ReceivedMessage\n\nclass Bot():\n \"\"\"\n @brief Facebook messenger bot\n \"\"\"\n\n def __init__(self,...
python
chosen
[ { "from": "system", "value": "Revise \"set preference\" notification to be clearer\n\nNotification message originally read as though it were in the\nimperative when it is meant to be in past tense.\n" }, { "from": "human", "value": "# yvs.set_pref\n# coding=utf-8\n\nfrom __future__ import unicod...
python
chosen
[ { "from": "system", "value": "Change stride semantic in MaxPool\n" }, { "from": "human", "value": "\"\"\"Pooling layer.\"\"\"\n\nfrom theano.tensor.signal import downsample\n\nfrom athenet.layers import Layer\n\n\nclass MaxPool(Layer):\n \"\"\"Max-pooling layer.\"\"\"\n def __init__(self, ...
python
chosen
[ { "from": "system", "value": "Create another task to get the litecoin price\n" }, { "from": "human", "value": "import json\nimport requests\n\nfrom bitcoinmonitor.celeryconfig import app\nfrom channels import Group\n\n\napp.conf.beat_schedule = {\n 'add-every-30-seconds': {\n 'task': '...
python
chosen
[ { "from": "system", "value": "Remove attachment and use slack link unfurling\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils import timezone\nfrom django.dispatch import receiver\nfrom django.conf import settings\n\nfr...
python
chosen
[ { "from": "system", "value": "Disable graphing unit tests until we fix logger.error conditions\n" }, { "from": "human", "value": "from basic import *\n# this generates a lot of non-exception generating errors\n# all the more incentive to fix these tests up sooner!\n# TODO - fix\nfrom views impor...
python
chosen
[ { "from": "system", "value": "[impala] Fix test looking for Impala icon\n\nUse regexp in tests for matching white spaces and new lines\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Licensed to Cloudera, Inc. under one\n# or more contributor license agreements. See the NOTICE file\...
python
chosen
[ { "from": "system", "value": "Add test logger if not added by nose\n" }, { "from": "human", "value": "# Copyright 2013-2014 DataStax, Inc.\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...
python
chosen
[ { "from": "system", "value": "Add a (skipped) test for row slice assignment.\n\nE. Bray requested the ability to assign to a table via a row with\nslice assignment, e.g.\n\nrow = table[2]\nrow[2:5] = [2, 3, 4]\nrow[:] = 3\n\nThis does not currently work because np.void (which is what numpy\nreturns for stru...
python
chosen
[ { "from": "system", "value": "Add support for creating snapshots for program owner\n" }, { "from": "human", "value": "# Copyright (C) 2017 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\nscope = \"Private Program\"\ndescription = \"\"\"\n User with...
python
chosen
[ { "from": "system", "value": "Add a StoryAdmin to hide owner.\n\nAlso has comment out code for automating owner and restrincting\nediting of a story to its owner and superuser. We can decide\nwhether we want it later (untested).\n" }, { "from": "human", "value": "from models import Story, Page,...
python
chosen
[ { "from": "system", "value": "Use context manager for filepointer management\n" }, { "from": "human", "value": "import json\nimport os\nimport logging\n\nlogger = logging.getLogger(__name__)\n\nHERE = os.path.dirname(os.path.realpath(__file__))\n\ngroups = json.load(\n open(\n os.path....
python
chosen
[ { "from": "system", "value": "Fix in output to help command.\n\nSigned-off-by: messiasthi <8562fc1efba9a3c99753c749fdfb1b6932b70fbf@gmail.com>\n" }, { "from": "human", "value": "# The client of DDuplicated tool.\nfrom os import path as opath, getcwd\nfrom pprint import pprint\nfrom sys import ar...
python
chosen
[ { "from": "system", "value": "Update in output to terminal.\n\nSigned-off-by: messiasthi <8562fc1efba9a3c99753c749fdfb1b6932b70fbf@gmail.com>\n" }, { "from": "human", "value": "# The client of DDuplicated tool.\nfrom os import path as opath, getcwd\nfrom pprint import pprint\nfrom sys import arg...
python
chosen
[ { "from": "system", "value": "\tAllow mutation commands from the test client.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nBinary memcached test client.\n\nCopyright (c) 2007 Dustin Sallings <dustin@spy.net>\n\"\"\"\n\nimport sys\nimport socket\nimport random\nimport struct...
python
chosen
[ { "from": "system", "value": "Fix Device model, not needed to set last_seen on creation\n" }, { "from": "human", "value": "import json\n\nfrom django.db import models\nimport requests\n\nfrom Suchary.settings import GCM_API_KEY\n\n\nclass Device(models.Model):\n registration_id = models.TextF...
python
chosen
[ { "from": "system", "value": "Add nbutils import to base import\n" }, { "from": "human", "value": "from . import layers\nfrom . import utils\nfrom . import nputils\nfrom . import tbutils\nfrom . import distributions\nfrom .utils import FileWriter\nfrom .tbutils import function\n" }, { "f...
python
chosen
[ { "from": "system", "value": "Format description to multiple lines using RawTextHelpFormatter.\n\nReference:\n# http://stackoverflow.com/questions/3853722/python-argparse-how-to-insert-newline-the-help-text\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\n# References:\n# http://docs...
python
chosen
[ { "from": "system", "value": "Add test for creating profile on user creation\n" }, { "from": "human", "value": "from django.contrib.auth.models import User\nfrom django.db import IntegrityError\nfrom django.test import TestCase\n\nfrom app.accounts.models import UserProfile\n\n\nclass UserProfil...
python
chosen
[ { "from": "system", "value": "Reorder URLs, catchall at the end\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\n\n# Uncomment the next two lines to enable the admin:\nfrom django.contrib import admin\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n ...
python
chosen
[ { "from": "system", "value": "Fix to_bytes when text is None\n" }, { "from": "human", "value": "# coding: utf-8\n\nimport base64\nfrom flask import request, Response\nfrom oauthlib.common import to_unicode, bytes_type\n\n\ndef extract_params():\n \"\"\"Extract request params.\"\"\"\n uri =...
python
chosen
[ { "from": "system", "value": "Use allclose for dataprep test\n" }, { "from": "human", "value": "import os\nimport pandas as pd\nimport numpy.testing as npt\n\nfrom gypsy import DATA_DIR\nfrom gypsy.data_prep import prep_standtable\n\n\ndef test_prep_standtable():\n data_file_name = 'raw_stand...
python
chosen
[ { "from": "system", "value": "Add cmdline options parser and a sanity check.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport Image\nimport logging\nimport sys\n\ndef main(argv):\n pngFileName = sys.argv[1]\n baseFileName, _ = pngFileName.rsplit('.')\n\n rawFileName = '%s.ra...
python
chosen
[ { "from": "system", "value": "Fix typo in redis error message\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nInterface to Redis-storage.\n\n@author: Seva Zhidkov\n@contact: zhidkovseva@gmail.com\n@license: The MIT license\n\nCopyright (C) 2015\n\"\"\"\nfrom .utils import l...
python
chosen
[ { "from": "system", "value": "Increase number of SoundCloud episodes pulled in\n\nThis is related to the fact that unpublished episodes still pull through." }, { "from": "human", "value": "import os\nimport inspect\n\n# Flask\nDEBUG = True\n\n# Amazon S3 Settings\nAWS_KEY = ''\nAWS_SECRET_KEY = ...
python
chosen
[ { "from": "system", "value": "Add method for merging duplicated events\n" }, { "from": "human", "value": "import datetime\nfrom django.shortcuts import render\nfrom apps.splash.models import SplashEvent, SplashYear\n\n\ndef index(request):\n # I'm really sorry ...\n splash_year = SplashYea...
python
chosen
[ { "from": "system", "value": "Make it clearer that exactly one item allows psum < 0\n" }, { "from": "human", "value": "def _dynamic_wrap(items, limit):\n scores, trace = [0], []\n for j in range(len(items)):\n best, psum, index = 0, limit, -1\n for i in reversed(range(j + 1))...
python
chosen
[ { "from": "system", "value": "Fix pad_tx off by one error + nits\n\nSummary: See title\n\nTest Plan: test_runner.py\n\nReviewers: deadalnix, schancel, #bitcoin_abc\n\nReviewed By: schancel, #bitcoin_abc\n\nSubscribers: teamcity\n\nDifferential Revision: https://reviews.bitcoinabc.org/D2096\n" }, { "...
python
chosen
[ { "from": "system", "value": "Add import in regression test\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nfrom ...tokens import Doc\nfrom ...vocab import Vocab\n\n\ndef test_issue600():\n doc = Doc(Vocab(tag_map={'NN': {'pos': 'NOUN'}}), words=['hello'])\n doc...
python
chosen
[ { "from": "system", "value": "Fix version with last package\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport sys\n\n__version__ = '0.6.0'\n\nFRAMEWORK_NAME = 'RAPyDo'\n# PROJECT_YAML_SPECSDIR = 'specs'\nCOMPOSE_ENVIRONMENT_FILE = '.env'\nSUBMODULES_DIR = 'submodules'\nPLACEHO...
python
chosen
[ { "from": "system", "value": "Fix unit tests for arg_parser\n" }, { "from": "human", "value": "\nimport unittest\n\nfrom tailorscad.arg_parser import parse_args\n\n\nclass TestArgParser(unittest.TestCase):\n\n def test_parse_args_none(self):\n\n args = []\n argv = []\n\n ...
python
chosen
[ { "from": "system", "value": "Add default RESOLUTION and STATUS in BugFactory.\n\n* Fixes failing tests.\n" }, { "from": "human", "value": "import datetime\nfrom django.utils.timezone import utc\n\nimport factory\nfrom factory import fuzzy\n\nfrom remo.profiles.tests import UserFactory\nfrom rem...
python
chosen
[ { "from": "system", "value": "Allow using DataStore class as if dict\n" }, { "from": "human", "value": "import json\nimport os\n\n\nclass DataStore(object):\n def __init__(self, storagePath=\"desertbot_data.json\"):\n self.storagePath = storagePath\n self.data = None\n se...
python
chosen
[ { "from": "system", "value": "Convert type check targets in thrift/test to use configuration\n\nSummary:\nMigrating buck integration to use configurations.\n For more information about this migration, please see: https://fb.workplace.com/groups/295311271085134/permalink/552700215346237/\n\nReviewed By: dkgi...
python
chosen
[ { "from": "system", "value": "Update the version to 1.4.0 for the latest release\n" }, { "from": "human", "value": "version_info = (1, 3, 0)\nversion = '.'.join(map(str, version_info))\n" }, { "from": "gpt", "value": "version_info = (1, 4, 0)\nversion = '.'.join(map(str, version_info...
python
chosen
[ { "from": "system", "value": "Update the library version to 1.1 for the recent change.\n" }, { "from": "human", "value": "from setuptools import setup\n\n# This is the atca_rapid_response_api Python library.\n# Jamie Stevens 2017\n# ATCA Senior Systems Scientist\n# Jamie.Stevens@csiro.au\n\nsetu...
python
chosen
[ { "from": "system", "value": "Add settings to turn off live mode\n" }, { "from": "human", "value": "import sublime\nimport sublime_plugin\nimport view_collection\n\nclass GitGutterEvents(sublime_plugin.EventListener):\n def on_new(self, view):\n view_collection.ViewCollection.add(view)\n\n ...
python
chosen
[ { "from": "system", "value": "Update to the latest osf API\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nimport requests\n\nfrom scrapi import settings\nfrom scrapi.processing.osf.hashing import REPORT_HASH_FUNCTIONS\nfrom scrapi.processing.osf.hashing import RESO...
python
chosen
[ { "from": "system", "value": "Remove f-string for pre-Python 3.6 support.\n" }, { "from": "human", "value": "from .oauth import BaseOAuth2\n\n\nclass UniverseOAuth2(BaseOAuth2):\n \"\"\"Universe Ticketing OAuth2 authentication backend\"\"\"\n name = 'universe'\n AUTHORIZATION_URL = 'htt...
python
chosen
[ { "from": "system", "value": "Move GC collect after loading unit test function.\n" }, { "from": "human", "value": "# OpenMV Unit Tests.\n#\nimport os, sensor, gc\n\nTEST_DIR = \"unittest\"\nTEMP_DIR = \"unittest/temp\"\nDATA_DIR = \"unittest/data\"\nSCRIPT_DIR = \"unittest/script\"\n\n...
python
chosen
[ { "from": "system", "value": "Reduce number of tweets to reduce CPU compuation time of the unoptimised models\n" }, { "from": "human", "value": "from flask import Blueprint, request, render_template\nfrom ..load import processing_results, api\nimport string\nimport tweepy\n\n\ntwitter_mod = Blue...
python
chosen
[ { "from": "system", "value": "Use resource_string for error messages\n\nSigned-off-by: Michael Barton <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@michaelbarton.me.uk>\n" }, { "from": "human", "value": "import sys, yaml, os.path\n\ndef select_module(module, name):\n \"\"\"\n Select and return...
python
chosen
[ { "from": "system", "value": "Change comparison to be non-strict.\n" }, { "from": "human", "value": "from datetime import date\n\nfrom base import Calendar\nfrom date import InvalidDate\nfrom main import JulianCalendar\n\nclass JulianToGregorianCalendar(Calendar):\n def date(self, year, month...
python
chosen
[ { "from": "system", "value": "Improve error catching logic for update\n" }, { "from": "human", "value": "import os\nimport subprocess\nimport sys\n\ntry:\n from flask import Flask\n import flask_login\n from flask_restless import APIManager\n from flask_sqlalchemy import SQLAlchemy\n...
python
chosen
[ { "from": "system", "value": "Fix for taking feed from a split output\n" }, { "from": "human", "value": "# pipetruncate.py\n#\n\nfrom pipe2py import util\n\ndef pipe_truncate(context, _INPUT, conf, **kwargs):\n \"\"\"This operator truncates the number of items in a feed.\n\n Keyword argume...
python
chosen
[ { "from": "system", "value": "Use 'fields' instead of 'kwargs' to document intent.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nThe Renderer class provides the infrastructure for generating template-based\ncode. It's used by the .grammars module for parser generation.\n\"\...
python
chosen
[ { "from": "system", "value": "Remove string views in urlpatterns\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom haystack.views import SearchView, search_view_factory\n\nfrom ..forms import AdvancedSearchForm\n\nsearch_view = search_view_factory(view_class=SearchView,\n...
python
chosen
[ { "from": "system", "value": "Allow TypeParameters to 'grap' attr from param_dict\n" }, { "from": "human", "value": "from hoomd.parameterdicts import AttachedTypeParameterDict\n\n\nclass TypeParameter:\n def __init__(self, name, type_kind, param_dict):\n self.name = name\n self....
python
chosen
[ { "from": "system", "value": "Fix missing comparison operator in StripColors\n" }, { "from": "human", "value": "from twisted.plugin import IPlugin\nfrom txircd.module_interface import IMode, IModuleData, Mode, ModuleData\nfrom txircd.utils import ModeType, stripFormatting\nfrom zope.interface im...
python
chosen
[ { "from": "system", "value": "Add created_at to Issue model\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nclass Issue(models.Model):\n title = models.CharField(_('Title'), max_length=150)\n description = models.T...
python
chosen
[ { "from": "system", "value": "Handle in case user cancels open skin as project command\n" }, { "from": "human", "value": "import os\nimport subprocess\n\nimport sublime\nimport sublime_plugin\n\nfrom .path.skin_path_provider import get_cached_skin_path\n\n\nclass RainmeterOpenSkinAsProjectComman...
python
chosen
[ { "from": "system", "value": "Put seasons and subreddit into a response object for the api\n" }, { "from": "human", "value": "from flask import Flask, jsonify, render_template\nimport test, stats, os\napp = Flask(__name__)\n\ncache = {}\n\n@app.route('/')\ndef hello_world():\n return 'Hello W...
python
chosen
[ { "from": "system", "value": "Update the Gensim API usage\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport argparse\nimport sys\nfrom gensim.models.word2vec import Word2Vec\nimport csv\n\nfrom signal import signal, SIGINT\nsignal(SIGINT, lambda signum, frame: sys.exit(1))\n\npa...
python
chosen
[ { "from": "system", "value": "Remove that ... awkward... code\n" }, { "from": "human", "value": "#!/usr/bin/python2\nimport lala\nimport ConfigParser\nimport sys\n\ndef main():\n \"\"\"Main method\"\"\"\n config = ConfigParser.SafeConfigParser()\n config.read(\"config\")\n lalaconfig...
python
chosen
[ { "from": "system", "value": "Fix rendering of alfred.is data to json file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n# Define here the models for your scraped items\n#\n# See documentation in:\n# http://doc.scrapy.org/en/latest/topics/items.html\n\nimport scrapy\n\n\ndef sing...
python
chosen
[ { "from": "system", "value": "Make the extrn object use the convention for rebased addresses\n" }, { "from": "human", "value": "from cle.absobj import AbsObj\n\nclass AngrExternObject(AbsObj):\n def __init__(self, alloc_size=0x1000):\n super(AngrExternObject, self).__init__('##angr_ext...
python
chosen
[ { "from": "system", "value": "Bump version to development version\n" }, { "from": "human", "value": "# -*- coding: utf-8; mode: Python; -*-\nfrom __future__ import unicode_literals\n\n__title__ = 'Python implementation of a REST based storage'\n\n# Please use PEP 0440 version strings.\n# https:/...
python
chosen
[ { "from": "system", "value": "Remove \" \" from log name\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport datetime\nimport logging\nimport os\nimport hashlib\n\nfrom utils.settings_handler import settings\n\n\ndef set_up_logging():\n \"\"\"\n Logger for tenhou communica...
python
chosen
[ { "from": "system", "value": "Fix employee form error about password hashing\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom .models import Employee, Role\n\n\nclass RoleAdmin(admin.ModelAdmin):\n list_display = (\"name\",)\n\n\nclass EmployeeAdmin(admin.ModelAdmin):...
python
chosen
[ { "from": "system", "value": "Add support for full screen." }, { "from": "human", "value": "#!/usr/bin/python\n#coding=utf8\n\nfrom Tkinter import *\nimport sys\nfrom ui import Gui\n \nif __name__ == '__main__':\n Root = Tk()\n App = Gui(Root)\n App.pack(expand='yes',fill='both')\n ...
python
chosen
[ { "from": "system", "value": "Add option to create/drop the database\n" }, { "from": "human", "value": "import argparse\n\nfrom config import app_config as cfg\n\nfrom libraries.database_init import DataBase\nfrom libraries.tweetimporter import TweetImporter\nfrom libraries.twitterclient import ...
python
chosen
[ { "from": "system", "value": "Add key param to geojson scraper\n\nSometimes we encounter a geojson file with no 'id' attribute\nThis allows us to specify a property to use as a key instead\n" }, { "from": "human", "value": "import json\nimport os\nimport urllib.request\nfrom retry import retry\n...
python
chosen
[ { "from": "system", "value": "Use cached property decorator connection pool.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nimport urllib3\n\ntry:\n import simplejson as json\nexcept ImportError:\n import json # pyflakes.ignore\n\nfro...
python
chosen
[ { "from": "system", "value": "Add the bits that cmsenv/cmsRun actually need.\n" }, { "from": "human", "value": "from itertools import imap\nimport os\nimport re\nimport sys\nimport tarfile\n\ndef dontpack(fn):\n return '/.' in fn or '/CVS/' in fn\n\ndef package(indir, outfile):\n try:\n ...
python
chosen
[ { "from": "system", "value": "Add fallback method for finding library versions\n\nFor library 'iris' the version number cannot be found in the pkg_resources\nworking set. It is unclear why.\n\nThe version number can be found using iris.__version__, so re-added the old\nversion finding code as a fallback.\n"...
python
chosen