conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add future as required package (for Python2)\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(name='mathprogbasepy',\n version='0.1.1',\n author='Bartolomeo Stellato',\n description='Low level interface for mathematical progr...
python
chosen
[ { "from": "system", "value": "Fix description content type for PyPi\n" }, { "from": "human", "value": "\"\"\"\nThe setup package to install MasterQA requirements\n\"\"\"\n\nfrom setuptools import setup, find_packages # noqa\nfrom os import path\n\n\nthis_directory = path.abspath(path.dirname(__...
python
chosen
[ { "from": "system", "value": "Add Python 3 support via classifier\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import find_packages, setup\n\nproject = \"openapi\"\nversion = \"1.0.0\"\n\nsetup(\n name=project,\n version=version,\n description=\"Python OpenA...
python
chosen
[ { "from": "system", "value": "Update trove classifier to Stable. Update my info.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\n\ntry:\n from setuptools import setup\nexcept ImportError:\n from distutils.core import setup\n\n\nreadme = open('README.rst').read()\nhistory = open...
python
chosen
[ { "from": "system", "value": "Update the PyPI version to 0.2.24.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nimport os\nfrom setuptools import setup\n\ndef read(fname):\n try:\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n except:\n ret...
python
chosen
[ { "from": "system", "value": "Add a progress tracker to the async task command\n" }, { "from": "human", "value": "from abc import abstractmethod\n\nfrom django.core.management.base import BaseCommand\n\n\nclass TaskCommand(BaseCommand):\n def start_progress(self, *args, **options):\n #...
python
chosen
[ { "from": "system", "value": "Add two new helpers for creating concrete model tables on the fly\n\nThese are extremely simple, but they provide the basis for dynamically\ncreating a model table and deleting it for each test case. Going this\nroute instead of setting it up per TestCase to allow running in\n...
python
chosen
[ { "from": "system", "value": "Introduce a complete user operations example\n" }, { "from": "human", "value": "from pyolite import Pyolite\n\n# initial olite object\nadmin_repository = 'gitolite-admin/'\nolite = Pyolite(admin_repository=admin_repository)\n\nbob = olite.users.create(name='bob', ke...
python
chosen
[ { "from": "system", "value": "Change confirm delete url. /v2/nodes/{pk}/pointers was being read as /v2/nodes/{pk}/{token} and returning 'Incorrect token' instead of pointers list.\n" }, { "from": "human", "value": "from django.conf.urls import url\nfrom api.nodes import views\n\nurlpatterns = [...
python
chosen
[ { "from": "system", "value": "Add get_variant_url method to content node.\n" }, { "from": "human", "value": "from .. import api_utils\n\nclass ContentNode(object):\n\n def __init__(self, document, _isChildrenPopulated=False):\n self.document = document\n self._isChildrenPopulated = _isChi...
python
chosen
[ { "from": "system", "value": "Remove meta data around unsupported versions\n" }, { "from": "human", "value": "from setuptools import setup\n\ndef readme():\n with open('README.rst') as f:\n return f.read()\nsetup(\n name='hashdb2',\n version='0.3',\n description='HashDb2 provi...
python
chosen
[ { "from": "system", "value": "Add python package install dependency\n\nAdd babel as python package install dependency. Babel is used in\nphonenumber_field.widget." }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom phonenumber_field import __version__\n\n\nsetup(\n...
python
chosen
[ { "from": "system", "value": "Increment version number in tarball\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='runcalc',\n version='0.1.1',\n description='Running pace calculator',\n author='Mike Patek',\n author_email='mpatek@gmail.com',\n ...
python
chosen
[ { "from": "system", "value": "Remove shell console script from entry points\n\nAmends e09ee16a77a7181fbf8ee18841be6ca37fd32250\n" }, { "from": "human", "value": "from setuptools import setup, PEP420PackageFinder\n\n\nsetup(\n name='tangled.web',\n version='1.0a13.dev0',\n description='R...
python
chosen
[ { "from": "system", "value": "Add ipybind.ext package to the manifest\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport re\nimport ast\nfrom setuptools import setup\n\n_version_re = re.compile(r'__version__\\s+=\\s+(.*)')\n\nwith open('ipybind/__init__.py', 'rb') as f:\n ve...
python
chosen
[ { "from": "system", "value": "Package is now successfully getting integrated in a django project. So version increased\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom distutils.core import setup\nfrom setuptools import find_packages\n\nsetup(\n name='django-tests-assistant',\...
python
chosen
[ { "from": "system", "value": "Include templates, etc, with install\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom sys import version_info\n\nassert version_info >= (2,7)\n\nsetup(\n name='molly',\n version='2.0dev',\n packages=find_packages(exclude=...
python
chosen
[ { "from": "system", "value": "Package classifiers: Explicitly target Python 2.7\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom distutils.core import setup\n\nsetup(\n name='django-payfast',\n version='0.2.2',\n author='Mikhail Korobov',\n author_email='kmike84@gmail.c...
python
chosen
[ { "from": "system", "value": "Upgrade dependency appdirs to ==1.4.3\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup\n\nfrom withtool import __version__\n\n\ndef read(fname):\n path = os.path.join(os.path.dirname(__file__), fname)\n with open(path, encoding='utf...
python
chosen
[ { "from": "system", "value": "Upgrade to v0.1.2 and properly add dictobj as an installation requirement.\n" }, { "from": "human", "value": "from setuptools import setup\nimport os\n\ndef read(filename):\n fin = None\n data = None\n try:\n fin = open(filename)\n data = fin.read()\n fina...
python
chosen
[ { "from": "system", "value": "Revert \"hide worker and coordinator\"\n\nThis reverts commit f73ce955ef6a2562f75f3311de279d43566dba08.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom setuptools import setup, find_packages\n\nname = 'Mikko Korpela'\n# I might be just a ...
python
chosen
[ { "from": "system", "value": "Fix the github repo name.\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(name='journal_dates',\n packages=[''],\n version='0.1',\n description='Prints a monthly journal template',\n url='http://github.com/bzamecnik/journ...
python
chosen
[ { "from": "system", "value": "Make sure urllib2 is installed\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nfrom distutils.core import setup\nimport codecs\nimport os.path as path\n\ncwd = path.dirname(__file__)\nversion = '0.0.0'\nwith codecs.open(path.join(cwd, 'mlbgame/version.p...
python
chosen
[ { "from": "system", "value": "Convert README.md to rst in long_description\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nos.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'\n\nsetup(\n name=\"django-nopassword\",\n version='1.3.1',\n ur...
python
chosen
[ { "from": "system", "value": "Fix error with setting version\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(name='bmi-ilamb',\n version=execfile('./bmi_ilamb/version.py'),\n description='BMI for ILAMB',\n long_description=open('README.md'...
python
chosen
[ { "from": "system", "value": "Remove a debug statement (1/0.)\n" }, { "from": "human", "value": "from __future__ import print_function\nimport sys, os\nfrom setuptools import setup, find_packages\n\nwith open('requirements.txt') as f:\n INSTALL_REQUIRES = [l.strip() for l in f.readlines() if ...
python
chosen
[ { "from": "system", "value": "Mark version 1.1.1 with license.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom distutils.core import setup\n\nsetup(name='straight.plugin',\n version='1.0',\n description='A simple namespaced plugin facility',\n author='Calvin Speal...
python
chosen
[ { "from": "system", "value": "Add upload file console script\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='myria-python',\n version='1.1',\n author='Daniel Halperin',\n author_email='dhalperi@cs.washington.edu',\n packages=find_pa...
python
chosen
[ { "from": "system", "value": "Use rpy2 version available through conda (2.8.5)" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom glob import glob\n\n__author__ = 'shafferm'\n__version__ = '0.1.1'\n\n\nsetup(\n name=\"dada2_qiime1\",\n version=__version__,\n...
python
chosen
[ { "from": "system", "value": "Update dependencies and version number, NB from the OECD rates for all dates are now included, not only those that fall before FERD rates\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\n\nsetup(\n name='exchangerates',\n versi...
python
chosen
[ { "from": "system", "value": "Update license details according to pypi standards\n" }, { "from": "human", "value": "from setuptools import setup\n\nversion = '0.2beta'\n\nsetup(\n name='boilerpipy',\n version=version,\n description='Readability/Boilerpipe extractor in Python',\n auth...
python
chosen
[ { "from": "system", "value": "Add English natural language classifier\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name='pysummarize',\n version='0.5.0',\n description='Simple Python and NLTK-based implementation of text summarization',\n ...
python
chosen
[ { "from": "system", "value": "Update filter. Review by @nicolaasdiebaas\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name=\"seed-stage-based-messaging\",\n version=\"0.1\",\n url='http://github.com/praekelt/seed-stage-based-messaging',\n ...
python
chosen
[ { "from": "system", "value": "Bump version and make better attemp at generating README\n" }, { "from": "human", "value": "\"\"\"\nUsage instructions:\n\n- If you are installing: `python setup.py install`\n- If you are developing: `python setup.py sdist bdist --format=zip bdist_wheel --universal`...
python
chosen
[ { "from": "system", "value": "Increase the version to 0.2\n\nAn backward incompatible change was introduced by removing the package\nnames metadata from the inventory core.\n\nIf necessary, it is hereby advised to provide the metadata in other ways\nsupported by ansible, such as variables defined on role or...
python
chosen
[ { "from": "system", "value": "Include codegen package in distribution.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom setuptools import setup\n\ntry:\n from Cython.Build import cythonize\nexcept ImportError:\n CYTHON = False\nelse:\n CYTHON = True\n\nsetup(\n name='...
python
chosen
[ { "from": "system", "value": "Make this the alpha release of 1.0.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n\nfrom setuptools import setup\n\nimport os.path\n\nscripts = ['bpln', 'cbpn', 'mcmcbpn', 'sabpn']\nscripts = [os.path.sep.join(('scripts', script)...
python
chosen
[ { "from": "system", "value": "Write Pixmap to a StringIO for uploading.\n" }, { "from": "human", "value": "import platform\n\nRUNNING_IN_HELL = platform.system() == 'Windows'\nRUNNING_IN_STEVE_JOBS = platform.system() == 'Darwin'\nRUNNING_IN_GANOO_LOONIX = platform.system() == 'Linux'" }, { ...
python
chosen
[ { "from": "system", "value": "Use set to compare elements between two lists (making them immutable)\n" }, { "from": "human", "value": "from common import *\nimport tempfile\n\n\ndef test_from_json(ds_local):\n df = ds_local\n\n # Create temporary json files\n pandas_df = df.to_pandas_df...
python
chosen
[ { "from": "system", "value": "Fix return values of placeholder functions\n\nThis allows to get nicer type completions in the IDE.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"\nDispatch module. Explanation functions for conctere estimator classes\nare defined in submodules.\...
python
chosen
[ { "from": "system", "value": "Fix error when already renamed\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nimport sys\nfrom string import Template\nimport argparse\nimport hashlib\n\nif __name__ == \"__main__\":\n parser = argparse.ArgumentParser(description='Rename f...
python
chosen
[ { "from": "system", "value": "Allow to use custom templates for products details pages\n" }, { "from": "human", "value": "from __future__ import unicode_literals\n\nfrom django.http import HttpResponsePermanentRedirect\nfrom django.contrib import messages\nfrom django.shortcuts import get_object...
python
chosen
[ { "from": "system", "value": "Update createdirs to determine the absolute path of files\n" }, { "from": "human", "value": "\"\"\"NLP pipeline utility functionality\"\"\"\nimport os\n\ndef remove_ext(fname):\n \"\"\"Removes the extension from a filename\n \"\"\"\n bn = os.path.basename(f...
python
chosen
[ { "from": "system", "value": "Make Result.stdout_lines and stderr_lines cached properties\n\nI guess it probably doesn't matter much for performance, but we might as\nwell avoid splitting output into lines eagerly since it's typically not\nused.\n" }, { "from": "human", "value": "\nclass Result:...
python
chosen
[ { "from": "system", "value": "Change log level to CRITICAL\n" }, { "from": "human", "value": "\"\"\"main routine for Ample testing\"\"\"\nimport os\nimport sys\nfrom ample.util import exit_util, logging_util\nfrom ample.testing import run_tests\n\nlogger = logging_util.setup_console_logging(form...
python
chosen
[ { "from": "system", "value": "Make integration test work again with usage of SSL\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport urllib.parse\nimport urllib.request\n\ndef create_player(username, password, email):\n url = 'http://localhost:3000/players'\n values = {'userna...
python
chosen
[ { "from": "system", "value": "Change import style in example.\n" }, { "from": "human", "value": "import os\n\nfrom bonobo import Graph\n\n\ndef extract():\n env_test_user = os.getenv('ENV_TEST_USER')\n env_test_number = os.getenv('ENV_TEST_NUMBER')\n env_test_string = os.getenv('ENV_TES...
python
chosen
[ { "from": "system", "value": "Fix auto importing test_config if it is not there\n" }, { "from": "human", "value": "import os\nimport random\nfrom shutil import copyfile\n\nfrom behaving import environment as benv\nfrom behaving.web.steps import *\nfrom behaving.personas.steps import *\n\nfrom te...
python
chosen
[ { "from": "system", "value": "Fix fieldname mapping for riemann (should be host, not hostname)\n" }, { "from": "human", "value": "# For determining hostname\nimport socket\n\nimport logging\nlog = logging.getLogger(__name__)\n\nclass Events():\n\tdef __init__(self):\n\t\tself.events = []\n\n\tde...
python
chosen
[ { "from": "system", "value": "Change Python 2.x import to fall-back to pure Python code if it can't load the C extension.\n" }, { "from": "human", "value": "\"\"\"\nConsistent Overhead Byte Stuffing (COBS) encoding and decoding.\n\nFunctions are provided for encoding and decoding according to\nt...
python
chosen
[ { "from": "system", "value": "Update py27 compatibility in print function\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom flowgen.graph import Graph\nfrom flowgen.language import Code\nfrom flowgen.options import parser\nfrom pypeg2 import parse\nfrom pypeg2.xmlast import thing2...
python
chosen
[ { "from": "system", "value": "Create model for post revisions.\n" }, { "from": "human", "value": "from django.db import models\nimport django.contrib.auth.models as auth\n\nclass User(auth.User):\n \"\"\"Model for representing users.\n\n It has few fields that aren't in the standard authen...
python
chosen
[ { "from": "system", "value": "Revert \"apply caveman rate limiting to europe pmc api calls\"\n\nThis reverts commit f2d0b4ab961325dfffaf3a54603b56e848f46da0.\n" }, { "from": "human", "value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nfrom time import sleep\n\nfrom cachetools import LRUCache...
python
chosen
[ { "from": "system", "value": "Add default init for Team Class\n" }, { "from": "human", "value": "from sqlalchemy import Column, Integer, String\nfrom sqlalchemy.orm import relationship\n\nfrom scoring_engine.models.base import Base\n\n\nclass Team(Base):\n __tablename__ = 'teams'\n id = Co...
python
chosen
[ { "from": "system", "value": "Convert config[\"PORT\"] to int before using.\n" }, { "from": "human", "value": "from threading import Thread, Event\n\nfrom weavelib.services import BaseService, BackgroundThreadServiceStart\n\nfrom .server import MessageServer\nfrom .appmgr import ApplicationRegis...
python
chosen
[ { "from": "system", "value": "Make sure that the channel creation and storage works\n\nSigned-off-by: Rohan Jain <f3a935f2cb7c3d75d1446a19169b923809d6e623@gmail.com>\n" }, { "from": "human", "value": "import json\nfrom tornado import testing, httpserver\n\nfrom qotr.server import make_applicatio...
python
chosen
[ { "from": "system", "value": "Update theme configuration to latest pyramid_frontend API\n" }, { "from": "human", "value": "from pyramid_frontend.theme import Theme\nfrom pyramid_frontend.images import FilterChain\n\n\nclass LightTheme(Theme):\n key = 'light'\n require_config_path = '/_ligh...
python
chosen
[ { "from": "system", "value": "Add end_time as editable on the slot list view to make tweaking times easier\n" }, { "from": "human", "value": "from django.contrib import admin\nfrom django import forms\n\nfrom wafer.schedule.models import Venue, Slot, ScheduleItem\nfrom wafer.talks.models import ...
python
chosen
[ { "from": "system", "value": "Add function to get the skeletal muscle result\n" }, { "from": "human", "value": "from wcontrol.conf.config import BMI, BFP\n\n\nclass results(object):\n def __init__(self, control, gender):\n self.bmi = self.get_bmi(control.bmi)\n self.fat = self.g...
python
chosen
[ { "from": "system", "value": "Use same order as matplotlib for PySize/PyQT\n" }, { "from": "human", "value": "import os\nimport warnings\n\nqt_api = os.environ.get('QT_API')\n\nif qt_api is None:\n try:\n import PySide\n qt_api = 'pyside'\n except ImportError:\n try:\n...
python
chosen
[ { "from": "system", "value": "Remove font serving from app\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.contrib.flatpages import urls\nfrom search.views import CustomSearchView\nfrom haystack.views import search_view_factory\nfrom django.con...
python
chosen
[ { "from": "system", "value": "Send all scraped data in one big json dump.\n" }, { "from": "human", "value": "#!/usr/bin/python\nimport sys\nimport api\nimport getpass\n\n# Banks\nbanks = {}\nimport bankofamerica\nbanks[\"bankofamerica\"] = bankofamerica\n\nprint \"Login\"\nprint \"Username: \",\...
python
chosen
[ { "from": "system", "value": "Fix exception when required options are missing\n\nOptions can be on command line and in config file, so we check in merged\ndictionary after getting from both sources.\n" }, { "from": "human", "value": "from sys import exit\n\nimport argparse\n\nfrom .commands impo...
python
chosen
[ { "from": "system", "value": "Increase timeout so that remote tests pass\n" }, { "from": "human", "value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\n\"\"\"\nastrometry.net\n--------------\n\n:author: Matt Craig (<mattwcraig@gmail.com>)\n\"\"\"\n\n# Make the URL of the s...
python
chosen
[ { "from": "system", "value": "Create a test for user creation through `FactoryBoy`\n\nAdd a test for user creation\n" }, { "from": "human", "value": "from django.core.urlresolvers import reverse\nfrom rest_framework.test import APITestCase\nfrom rest_framework import status\nimport factory\nfrom...
python
chosen
[ { "from": "system", "value": "Use the right name for the profile role's values.\n" }, { "from": "human", "value": "from django.shortcuts import render_to_response\n\ndef show_msg(user, message, redirect_url=None, url_desc=None):\n \"\"\" simply redirect to homepage \"\"\"\n\n return render...
python
chosen
[ { "from": "system", "value": "Fix validation split for NYU Depth V2 test\n" }, { "from": "human", "value": "\"\"\"Tests for NYU Depth V2 Dataset.\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nfrom tensorflow_datasets im...
python
chosen
[ { "from": "system", "value": "devilry_autoset_empty_email_by_username: Comment out the post_save connect line.\n" }, { "from": "human", "value": "from django.db.models.signals import post_save\nfrom devilry.devilry_account.models import User\nfrom django.conf import settings\n\n\ndef set_email_b...
python
chosen
[ { "from": "system", "value": "Fix spelling of my name\n" }, { "from": "human", "value": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.o...
python
chosen
[ { "from": "system", "value": "Add a negative similarity crutch\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nfrom signal import signal, SIGPIPE, SIG_DFL\nsignal(SIGPIPE, SIG_DFL)\n\nimport argparse\nimport sys\nfrom gensim.models.word2vec import Word2Vec\nimport csv\n\nparser = arg...
python
chosen
[ { "from": "system", "value": "Fix bug in distribution detection on unsupported platforms.\n" }, { "from": "human", "value": "import re\nfrom external.distro import linux_distribution\nfrom spack.architecture import OperatingSystem\n\n\nclass LinuxDistro(OperatingSystem):\n \"\"\" This class w...
python
chosen
[ { "from": "system", "value": "Fix out redirection in python2\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# vim: tabstop=4 shiftwidth=4 softtabstop=4\n#\n# Copyright (C) 2017 GEM Foundation\n#\n# OpenQuake is free software: you can redistribute it and/or modify it\n# under the ter...
python
chosen
[ { "from": "system", "value": "Include H2OSplitNode & H2OLeafNode in __all__" }, { "from": "human", "value": "from .tree import H2OTree\nfrom .tree import H2ONode\n\n__all__ = [\"H2OTree\", \"H2ONode\"]" }, { "from": "gpt", "value": "from .tree import H2OTree\nfrom .tree import H2ONod...
python
chosen
[ { "from": "system", "value": "Fix migration when no existing team.user field at fresh start\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.8 on 2018-12-19 11:53\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\nfrom orga...
python
chosen
[ { "from": "system", "value": "Clarify why test_import is failing under importlib.\n" }, { "from": "human", "value": "\"\"\"Run Python's standard test suite using importlib.__import__.\n\nTests known to fail because of assumptions that importlib (properly)\ninvalidates are automatically skipped i...
python
chosen
[ { "from": "system", "value": "Allow log group to be set from env\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\nimport os\nfrom app import create_app\nfrom flask.ext.script import Manager, Server\nimport watchtower\nimport logging\n\n\napplication = create_app(\n os.getenv('EQ_EN...
python
chosen
[ { "from": "system", "value": "Remove repeat option from coverage\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\"\"\"py.test utilities.\"\"\"\n\n#------------------------------------------------------------------------------\n# Imports\n#------------------------------------------...
python
chosen
[ { "from": "system", "value": "Fix typo in docs websocket_async code example\n" }, { "from": "human", "value": "import logging\nlogging.basicConfig(level=logging.INFO)\n\nfrom gql import gql, Client, WebsocketsTransport\nimport asyncio\n\nasync def main():\n\n transport = WebsocketsTransport(u...
python
chosen
[ { "from": "system", "value": "Refactor URL imports and paths\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom .views import DisplayCreate\nfrom .views import DisplayDelete\nfrom .views import DisplayDetail\nfrom .views import DisplayList\nfrom .views import DisplayUpda...
python
chosen
[ { "from": "system", "value": "Update code of NTM based on Keras.\n" }, { "from": "human", "value": "import memory\nimport head\n# import write_heads\n\nfrom keras import backend as K\n\nnumber_of_memory_locations = 6\nmemory_vector_size = 3\n\nmemory_t = memory.initial(number_of_memory_locations...
python
chosen
[ { "from": "system", "value": "Edit import module. pygraphc is now ready to be packaged\n" }, { "from": "human", "value": "# for local run, before pygraphc packaging\nimport sys\nsys.path.insert(0, '../pygraphc/misc')\nfrom IPLoM import *\nsys.path.insert(0, '../pygraphc/evaluation')\nfrom Extern...
python
chosen
[ { "from": "system", "value": "Make this usable (at least testable)\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\n# Uncomment the next two lines to enable the admin:\n# from django.contrib import admin\n# admin.autodiscover()\n\nurlpatterns = patterns('',\n # Ex...
python
chosen
[ { "from": "system", "value": "Add support for Arch Linux mathjax package\n\nFixes #4.\n" }, { "from": "human", "value": "# This file is part of python-markups module\n# License: 3-clause BSD, see LICENSE file\n# Copyright: (C) Dmitry Shachnev, 2012-2018\n\nimport os.path\n\n# Some common constan...
python
chosen
[ { "from": "system", "value": "Correct typo in setting names" }, { "from": "human", "value": "import string\n\nfrom django.conf import settings\n\n\nCOUPON_TYPES = getattr(settings, 'COUPONS_COUPON_TYPES', (\n ('monetary', 'Money based coupon'),\n ('percentage', 'Percentage discount'),\n ...
python
chosen
[ { "from": "system", "value": "Fix issue with scrapy local settings\n" }, { "from": "human", "value": "# Local dev settings for scrapy\n# This is not the same\n\n# Local config for testing\nimport os\n\n# use this for running scrapy directly\n# PROJECT_ROOT = os.path.abspath(os.path.dirname(__fil...
python
chosen
[ { "from": "system", "value": "Change the way we get a clean, blank line before rendering letter bank\n" }, { "from": "human", "value": "from terminaltables import SingleTable\n\n\ndef render(object, **kw):\n if object == 'gallows':\n render_gallows(**kw)\n if object == 'bank':\n ...
python
chosen
[ { "from": "system", "value": "Fix path to statements and answers files.\n" }, { "from": "human", "value": "STA_F= \"/home/ormiret/cah/statements.txt\"\nANS_F= \"/home/ormiret/cah/answers.txt\"\nimport random\n\ndef rand_line(filename):\n with open(filename) as f:\n lines = f.readlines(...
python
chosen
[ { "from": "system", "value": "Use SystemRandom instead of insecure RNG\n" }, { "from": "human", "value": "\"\"\"\nIn here we shall keep track of all variables and objects that should be\ninstantiated only once and be common to pieces of GLBackend code.\n\"\"\"\n\n__version__ = '1.0.0'\n\n__all__...
python
chosen
[ { "from": "system", "value": "Add test cases for reporters.py\n" }, { "from": "human", "value": "import pytest\nfrom seqeval.reporters import DictReporter\n\n\n@pytest.mark.parametrize(\n 'rows, expected',\n [\n ([], {}),\n (\n [['PERSON', 0.82, 0.79, 0.81, 24]],\n...
python
chosen
[ { "from": "system", "value": "Mark current code as a dev version\n" }, { "from": "human", "value": "from __future__ import unicode_literals\nimport platform\n\n__version__ = '0.3.0'\n\nUSER_AGENT = 'daemail {} ({} {})'.format(\n __version__, platform.python_implementation(), platform.python...
python
chosen
[ { "from": "system", "value": "Add tests of terminals and nonterminals that are not in grammar\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\n:Author Patrik Valkovic\n:Created 23.06.2017 16:39\n:Licence GNUv3\nPart of grammpy\n\n\"\"\"\n\nfrom unittest import main, TestCase\nfr...
python
chosen
[ { "from": "system", "value": "[minor] Fix default website style patch (reload doc)" }, { "from": "human", "value": "import frappe\nfrom frappe.templates.pages.style_settings import default_properties\n\ndef execute():\n\tstyle_settings = frappe.get_doc(\"Style Settings\", \"Style Settings\")\n\t...
python
chosen
[ { "from": "system", "value": "Make mystery man the default Gravatar image\n\n" }, { "from": "human", "value": "# place inside a 'templatetags' directory inside the top level of a Django app (not project, must be inside an app)\n# at the top of your page template include this:\n# {% load gravatar...
python
chosen
[ { "from": "system", "value": "Add Markov Chain representation class\n" }, { "from": "human", "value": "from random import choice\n\nclass MarkovChain(object):\n \"\"\" An interface for signle-word states Markov Chains \"\"\"\n\n def __init__(self, text=None):\n self._states_map = {}...
python
chosen
[ { "from": "system", "value": "Support more general documentation path names.\n" }, { "from": "human", "value": "# encoding: utf-8\n\"\"\"\nURL conf for django-sphinxdoc.\n\n\"\"\"\nfrom django.conf.urls.defaults import patterns, url\nfrom django.views.generic import list_detail\n\nfrom sphinxdoc...
python
chosen
[ { "from": "system", "value": "Fix build break (renamed function)\n" }, { "from": "human", "value": "from msrest import Serializer\nfrom ..commands import command, description\nfrom ._command_creation import get_service_client\n\n@command('resource group list')\n@description('List resource groups...
python
chosen
[ { "from": "system", "value": "Fix example with wrong `handler` parameter name\n" }, { "from": "human", "value": "import time\nfrom osbrain import run_agent\nfrom osbrain import run_nameserver\n\n\ndef log_a(agent, message):\n agent.log_info('Log a: %s' % message)\n\n\ndef log_b(agent, message...
python
chosen
[ { "from": "system", "value": "Enable reindexing with v2 reindexer\n" }, { "from": "human", "value": "from django.core.management import BaseCommand, CommandError\nfrom corehq.pillows.case import get_couch_case_reindexer, get_sql_case_reindexer\nfrom corehq.pillows.xform import get_couch_form_rei...
python
chosen
[ { "from": "system", "value": "Add protection against empty PATH\n" }, { "from": "human", "value": "from __future__ import print_function\nimport os\nimport sys\n\ndef main():\n prefix = sys.prefix\n binpath = os.path.join(prefix, 'bin')\n\n PATH = os.environ.get('PATH', [])\n PATH = ...
python
chosen
[ { "from": "system", "value": "Make cleanBin escape carriage returns.\n\nWe get confusing output on terminals if we leave \\r unescaped.\n" }, { "from": "human", "value": "\ndef cleanBin(s, fixspacing=False):\n \"\"\"\n Cleans binary data to make it safe to display. If fixspacing is Tru...
python
chosen