conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add field short_url on flatpages model\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom googl.short import GooglUrlShort\n\nfrom opps.core.models import Publisha...
python
chosen
[ { "from": "system", "value": "Add unique together on _id and system\n" }, { "from": "human", "value": "from django.db import models\n\nfrom .base import BaseModel\n\n\nclass Tag(BaseModel):\n _id = models.CharField(max_length=1024)\n lower = models.CharField(max_length=1024)\n system = ...
python
chosen
[ { "from": "system", "value": "Remove debug_cache_key from entry point\n" }, { "from": "human", "value": "VERSION = (3, 0, 1)\n__version__ = '.'.join(map(str, VERSION if VERSION[-1] else VERSION[:2]))\n\n\nfrom django.apps import AppConfig\n\nfrom .simple import *\nfrom .query import *\nfrom .inv...
python
chosen
[ { "from": "system", "value": "Fix 'open reference' test case\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport unittest\nimport yv_suggest.open as yvs\nimport inspect\n\nclass WebbrowserMock(object):\n '''mock the builtin webbrowser module'''\n\n def open(self, url):\n ...
python
chosen
[ { "from": "system", "value": "Fix profile script to correctly use the credentials file\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# Reads a profile from ~/.aws/config and calls the command with\n# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set correctly.\nimport ConfigParser\nimp...
python
chosen
[ { "from": "system", "value": "Add GaborFourier to default import\n" }, { "from": "human", "value": "import appearance\n\nimport image\n\nfrom residual import (LSIntensity,\n ECC,\n GradientImages,\n GradientCorrelation)\n" }, { ...
python
chosen
[ { "from": "system", "value": "Remove hard dependency for pymongo.\n\nCaused by pulling the gui package into the signac namespace.\nFixes issue #24.\n" }, { "from": "human", "value": "\"\"\"Graphical User Interface (GUI) for configuration and database inspection.\n\nThe GUI is a leight-weight int...
python
chosen
[ { "from": "system", "value": "Enhance analytics with timing and status code info\n" }, { "from": "human", "value": "\"\"\"Checkouts application middleware\"\"\"\n\nimport logging\n\nlogger = logging.getLogger('analytics')\n\nclass Analytics():\n \"\"\"Tracks request details useful for analysi...
python
chosen
[ { "from": "system", "value": "Fix alembic migration for rpms->artifacts rename\n\nThe migration does not work on MySQL-based engines, because it\nrequires setting the existing_type parameter [1]. It worked fine\non SQLite, though.\n\n[1] - https://alembic.sqlalchemy.org/en/latest/ops.html#alembic.operations...
python
chosen
[ { "from": "system", "value": "Correct the --omit parameter for coverage.py\n\nDespite what some things on the web suggest, you seem to need\nto have a wildcard at the end of a path in the --omit list.\n" }, { "from": "human", "value": "#!/bin/bash\n\nfind . -name '*.pyc' -delete\n\ncoverage eras...
python
chosen
[ { "from": "system", "value": "Correct the url for the rating instance resource\n" }, { "from": "human", "value": "from django.conf.urls import patterns, include, url\nfrom django.views import generic as views\nfrom . import resources\n\n# Uncomment the next two lines to enable the admin:\nfrom d...
python
chosen
[ { "from": "system", "value": "Improve ISBN field in Book Type form\n\n- Add required, pattern (to allow only numbers and dashes in HTML5-supporting browsers) and title properties\n- Remove a bit of redundant code\n" }, { "from": "human", "value": "from django import forms\nfrom django.forms impo...
python
chosen
[ { "from": "system", "value": "Add exception to test title\n" }, { "from": "human", "value": "from __future__ import absolute_import, print_function\nimport unittest\nfrom qtpy.QtWidgets import QApplication\nfrom addie.rietveld import event_handler\n\n\nclass RietveldEventHandlerTests(unittest.Te...
python
chosen
[ { "from": "system", "value": "Add command line interface to vary num-games and num-cards.\n" }, { "from": "human", "value": "import numpy as np\nimport random\n\nimport game as g\nimport hand_optimizer\n\ngame = g.PineappleGame1()\n\nNUM_ITERS = 1000\n\nutilities = []\nfor iter_num in xrange(NUM...
python
chosen
[ { "from": "system", "value": "Make stage outputter a little cleaner\n" }, { "from": "human", "value": "'''\nDisplay clean output of an overstate stage\n'''\n\n\n#[{'group2': {'match': ['fedora17-2', 'fedora17-3'],\n# 'require': ['group1'],\n# 'sls': ['nginx', 'edit']}\n# ...
python
chosen
[ { "from": "system", "value": "Add assert_not_in method for Python2.6\n" }, { "from": "human", "value": "\"\"\"Add some assert methods to nose.tools. These were added in Python 2.7/3.1, so\nonce we stop testing on Python 2.6, this file can be removed.\n\"\"\"\n\nimport nose.tools as nt\n\ndef ass...
python
chosen
[ { "from": "system", "value": "Write out page cache as unicode utf8\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nimport os\nimport json\nfrom datetime import datetime\nfrom bigbuild.models import PageList\nfrom bigbuild import get_archive_directory\nfrom djan...
python
chosen
[ { "from": "system", "value": "Make some simple unit test for RPC server.\n" }, { "from": "human", "value": "import unittest\n\nclass Test(unittest.TestCase):\n\n def setUp(self):\n self.seq = range(10)\n\n #def test_shuffle(self):\n # # make sure the shuffled sequence does not...
python
chosen
[ { "from": "system", "value": "Fix ubuntu version in test prog\n" }, { "from": "human", "value": "import azurerm\nimport json\n\n# Load Azure app defaults\ntry:\n with open('azurermconfig.json') as configFile: \n configData = json.load(configFile)\nexcept FileNotFoundError:\n print(\"...
python
chosen
[ { "from": "system", "value": "Enforce the use of Python 3.4 or higher\n" }, { "from": "human", "value": "import platform\n\n# -----------------------------------------------------------------------------\n# Guess platform we are running on\ndef current_platform():\n machine = platform.machine...
python
chosen
[ { "from": "system", "value": "Fix a bug which prepend the header to NA sequence\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\ndef load(fp):\n sequences = []\n header = None\n curseq = ''\n for line in fp:\n if line.startswith('>'):\n if header and ...
python
chosen
[ { "from": "system", "value": "Remove the files list endpoint\n" }, { "from": "human", "value": "from django.conf.urls import url\n\nfrom api.files import views\n\nurlpatterns = [\n url(r'^$', views.FileList.as_view(), name='file-list'),\n url(r'^(?P<file_id>\\w+)/$', views.FileDetail.as_vi...
python
chosen
[ { "from": "system", "value": "Change import name in deps test\n" }, { "from": "human", "value": "import os\nimport subprocess\nimport sys\n\nimport pytest\n\n\ndef test_adding_deps(tmpdir):\n with pytest.raises(ImportError):\n import sentinels\n\n projdir = tmpdir.join('proj')\n ...
python
chosen
[ { "from": "system", "value": "Allow users to add foremen plots for daemonized plotting.\n" }, { "from": "human", "value": "import datetime\nimport multiprocessing\n\nfrom lobster.cmssw.plotting import Plotter\n\nlogger = multiprocessing.get_logger()\n\nclass DummyPlotter(object):\n def make_p...
python
chosen
[ { "from": "system", "value": "Update scraper to account for new fields\n" }, { "from": "human", "value": "from django.core.management.base import BaseCommand\n\nfrom core.models import ConveneTime\nfrom legislators.models import Chamber\n\nimport requests\n\n\nclass Command(BaseCommand):\n he...
python
chosen
[ { "from": "system", "value": "Increase release number to 5 (1.3.0 Beta 3a)\n" }, { "from": "human", "value": "version = '1.3.0'\nmilestone = 'Chami'\nrelease_number = '4'\nprojectURL = 'http://syncplay.pl/'\n" }, { "from": "gpt", "value": "version = '1.3.0'\nmilestone = 'Chami'\nrele...
python
chosen
[ { "from": "system", "value": "Fix pylint error in this module\n" }, { "from": "human", "value": "try:\n from collections import defaultdict\nexcept ImportError:\n from _defaultdict import defaultdict\n\n__all__ = ('defaultdict',)\n" }, { "from": "gpt", "value": "try:\n #:E06...
python
chosen
[ { "from": "system", "value": "Check that at least one area has been checked\n" }, { "from": "human", "value": "from django.forms import (ModelForm, CheckboxSelectMultiple,\n MultipleChoiceField)\n\nfrom .models import AuthorityElection, AuthorityElectionPosition\n\n\ncla...
python
chosen
[ { "from": "system", "value": "Add test of callback function.\n" }, { "from": "human", "value": "from django.test import TestCase\n\n# Create your tests here.\n" }, { "from": "gpt", "value": "from django.test import TestCase\n\nfrom models import *\n\nclass SubscriptionTests(TestCase)...
python
chosen
[ { "from": "system", "value": "Add comments to explain what the script is doing on ingest\n" }, { "from": "human", "value": "## A quick script to fix the ridiculous format of the raw FAA download data (at least it's available though!)\n\nimport csv\n\n# MASTER.txt is from https://www.faa.gov/lice...
python
chosen
[ { "from": "system", "value": "Change from_spotify and from_gpm to classmethods\n" }, { "from": "human", "value": "class Track():\n artist = \"\"\n name = \"\"\n track_id = \"\"\n\n def __init__(self, artist, name, track_id=\"\"):\n self.artist = artist\n self.name = nam...
python
chosen
[ { "from": "system", "value": "Change norad API field to proper name\n" }, { "from": "human", "value": "from rest_framework import serializers\n\nfrom db.base.models import Satellite, Transponder\n\n\nclass SatelliteSerializer(serializers.ModelSerializer):\n class Meta:\n model = Satell...
python
chosen
[ { "from": "system", "value": "Make the collector exit if one of it's greenlets fails.\n" }, { "from": "human", "value": "# Source Server Stats\n# File: sourcestats/collector/__main__.py\n# Desc: __main__ for the collector\n\nfrom gevent import monkey\nmonkey.patch_all()\n\nimport sys\nimport log...
python
chosen
[ { "from": "system", "value": "Handle Ctrl + C when running demo in the terminal.\n" }, { "from": "human", "value": "import speech_recognition as sr\n\nr = sr.Recognizer()\nm = sr.Microphone()\n\nprint(\"A moment of silence, please...\")\nwith m as source:\n r.adjust_for_ambient_noise(source)\...
python
chosen
[ { "from": "system", "value": "Update factory registers with new classes.\n" }, { "from": "human", "value": "from kivy.factory import Factory\n\nr = Factory.register\n\nr('StageTreeNode', module='moa.render.treerender')\nr('StageSimpleDisplay', module='moa.render.stage_simple')\n\n\n# -----------...
python
chosen
[ { "from": "system", "value": "aafig: Rename package as sphinxcontrib-aafig\n* * *\naafig: Fix package name in PYPI URL\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nlong_desc = '''\nThis package contains the aafigure Sphinx extension...
python
chosen
[ { "from": "system", "value": "Remove pylint disables (for now)\n" }, { "from": "human", "value": "# Generated by Django 3.2.6 on 2021-08-23 18:33\n# pylint:disable=line-too-long\n# pylint:disable=missing-module-docstring\n# pylint:disable=\nfrom django.db import migrations, models\nimport django...
python
chosen
[ { "from": "system", "value": "Add point to execute program\n" }, { "from": "human", "value": "import json\nimport re\nimport requests\nimport socket\n\nimport settings\n\n\ndef get_responsible_user(full_url):\n members = settings.TEAM_MEMBERS\n response = requests.get(\n full_url,\n...
python
chosen
[ { "from": "system", "value": "Add utility method to register a resource\n" }, { "from": "human", "value": "import json\nfrom os import environ\n\nfrom eve import Eve\nfrom eve.io.mongo import Validator\n\nfrom settings import API_NAME, URL_PREFIX\n\n\nclass KeySchemaValidator(Validator):\n de...
python
chosen
[ { "from": "system", "value": "Handle FileNotFound exception from build_asset\n" }, { "from": "human", "value": "import mimetypes\nimport posixpath\nimport urllib\n\nfrom django.conf import settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.contrib.staticfiles.views im...
python
chosen
[ { "from": "system", "value": "Set default logging level to WARN.\n" }, { "from": "human", "value": "import datetime\nimport logging\n\nfrom django.core.management.base import BaseCommand\n\nimport mysite.profile.tasks\nimport mysite.search.models\nimport mysite.search.tasks\n\n## FIXME: Move to ...
python
chosen
[ { "from": "system", "value": "Remove version number from init\n" }, { "from": "human", "value": "from aqt import mw\n\nfrom .main import ReadingManager\n\n__version__ = '4.3.1'\n\nmw.readingManager = ReadingManager()\n" }, { "from": "gpt", "value": "from aqt import mw\n\nfrom .main i...
python
chosen
[ { "from": "system", "value": "Add more tests for sneeze." }, { "from": "human", "value": "\nimport os\nfrom tempfile import mkdtemp\nfrom shutil import rmtree\n\nfrom nipy.testing import *\nfrom sneeze import find_pkg, run_nose\n\nimport_strings = [\"from nipype.interfaces.afni import To3d\",\n ...
python
chosen
[ { "from": "system", "value": "Switch from multithreading to multiprocessing\n\nIt is easier to work with processes in terms of the current task.\nThe task was to make the client and updater work at the same time.\nThreads have a lot of limitations and are harder to get right, so I\nswitched to processes.\nT...
python
chosen
[ { "from": "system", "value": "Allow using strings for deltas and dates.\n" }, { "from": "human", "value": "from datetime import datetime\nfrom expire import expire as default_expire_func\n\n\n__all__ = ('BackupSimulator',)\n\n\ntry:\n from collections import OrderedDict # Python 2.7\nexcep...
python
chosen
[ { "from": "system", "value": "Fix failing TestMarketplace test by ensuring vanilla authentication and authorization\n" }, { "from": "human", "value": "from tastypie import http\nfrom tastypie.authorization import Authorization\nfrom test_utils import RequestFactory\n\nfrom amo.tests import TestC...
python
chosen
[ { "from": "system", "value": "Simplify datasets functions a bit\n" }, { "from": "human", "value": "\"\"\"Downloads the FITS files that are used in image testing and for building documentation.\n\n\n\"\"\"\n\nfrom astropy.utils.data import download_file\nfrom astropy.io import fits\n\n\ndef msx_h...
python
chosen
[ { "from": "system", "value": "Fix add_idea when multiple States have no previous\n" }, { "from": "human", "value": "from idea.models import State\n\ndef get_first_state():\n \"\"\" Get the first state for an idea. \"\"\"\n return State.objects.get(previous__isnull=True)\n" }, { "fr...
python
chosen
[ { "from": "system", "value": "Add int() wrapper to prevent floats\n" }, { "from": "human", "value": "import numpy as np\n\ndef scroll(clip, h=None, w=None, x_speed=0, y_speed=0,\n x_start=0, y_start=0, apply_to=\"mask\"):\n \"\"\" Scrolls horizontally or vertically a clip, e.g. to m...
python
chosen
[ { "from": "system", "value": "Add an expectedFailure decorator to the test_connect_remote() test case.\nIt fails when running within the context of the test suite, but succeeds\nwhen running alone.\n\n\ngit-svn-id: b33bab8abb5b18c12ee100cd7761ab452d00b2b0@127290 91177308-0d34-0410-b5e6-96231b3b80d8\n" }, ...
python
chosen
[ { "from": "system", "value": "Add common predicate for can_vote\n" }, { "from": "human", "value": "from likes.signals import likes_enabled_test, can_vote_test\nfrom likes.exceptions import LikesNotEnabledException, CannotVoteException\n\ndef _votes_enabled(obj):\n \"\"\"See if voting is enabl...
python
chosen
[ { "from": "system", "value": "Fix local search-api port to 5001\n\nWhen upgrading dmutils I've copied the new `init_manager` code from\nthe API but forgot to update the port.\n\nAlso adds mappings to the list of watched locations for the development\nserver, so the app will restart if the files are modified...
python
chosen
[ { "from": "system", "value": "Make test settings skippable via CMSPLUGIN_RST_SKIP_CONF environment variable.\n" }, { "from": "human", "value": "\nfrom test_app.settings import *\n\nINSTALLED_APPS += (\"cmsplugin_rst\",)\n\n\n## DJANGO CMSPLUGIN RST CONF ##\n\nCMSPLUGIN_RST_WRITER_NAME = \"html4c...
python
chosen
[ { "from": "system", "value": "Make PersistenceSettings a top-level export\n" }, { "from": "human", "value": "from model import BaseModel\n\nfrom feature import Feature, JSONFeature, TextFeature, CompressedFeature, \\\n PickleFeature\n\nfrom extractor import Node, Graph, Aggregator, NotEnoughD...
python
chosen
[ { "from": "system", "value": "Add test for reloading history including unicode (currently fails).\n" }, { "from": "human", "value": "# coding: utf-8\n\"\"\"These tests have to be run separately from the main test suite (iptest),\nbecause that sets the default encoding to utf-8, and it cannot be ...
python
chosen
[ { "from": "system", "value": "Change cluster data structure from list to dict\n" }, { "from": "human", "value": "import networkx as nx\n\n\nclass ConnectedComponents:\n \"\"\"This is a class for connected component detection method to cluster event logs [1]_.\n\n References\n ----------...
python
chosen
[ { "from": "system", "value": "Fix code so it works under Python 3.\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 information regarding copy...
python
chosen
[ { "from": "system", "value": "Fix default cache backend for Django < 1.3\n" }, { "from": "human", "value": "from appconf import AppConf\nfrom django.conf import settings\n\n\nclass ImageKitConf(AppConf):\n CACHEFILE_NAMER = 'imagekit.cachefiles.namers.hash'\n SPEC_CACHEFILE_NAMER = 'imagek...
python
chosen
[ { "from": "system", "value": "Add s3-http loader which delegates based on the uri\n" }, { "from": "human", "value": "from botornado.s3.bucket import AsyncBucket\nfrom botornado.s3.connection import AsyncS3Connection\nfrom botornado.s3.key import AsyncKey\n\nfrom thumbor_botornado.s3_loader impor...
python
chosen
[ { "from": "system", "value": "Make dict comparisons possible for DotDicts\n" }, { "from": "human", "value": "class DotDict(object):\n \"\"\"\n Immutable dict-like objects accessible by dot notation\n\n Used because the amount of configuration access is very high and just using\n dots...
python
chosen
[ { "from": "system", "value": "[wapitit] Add one signature for wapiti 2.2.1\n" }, { "from": "human", "value": "\"\"\"\n\n Wapiti does not provide ranking for the vulnerabilities it has found.\n This file tries to define a ranking for every vulnerability Wapiti might\n find.\n\n\"\"\"\n\n...
python
chosen
[ { "from": "system", "value": "Change field order at integration credential admin index page\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import, unicode_literals\nfrom django.contrib import admin\n\n\nclass IntegrationCredentialAdmin(admin.ModelAdmi...
python
chosen
[ { "from": "system", "value": "Use EURUSD for test order.\n" }, { "from": "human", "value": "import pytest\n\nimport ib_insync as ibi\n\npytestmark = pytest.mark.asyncio\n\n\nasync def test_request_error_raised(ib):\n contract = ibi.Stock('MMM', 'SMART', 'USD')\n order = ibi.MarketOrder('BU...
python
chosen
[ { "from": "system", "value": "Exclude reflections with -ve sigma (needed when reading XDS_ASCII.HKL as input)" }, { "from": "human", "value": "from iotbx.xds.read_ascii import reader\nimport sys\nfor n, argv in enumerate(sys.argv[1:]):\n r = reader(open(argv))\n mas = r.as_miller_arrays(me...
python
chosen
[ { "from": "system", "value": "Add HTML5 autofocus attribute to query form field.\n" }, { "from": "human", "value": "\"\"\"\nForms for the rdap_explorer project, query app.\n\"\"\"\n\nfrom django import forms\n\n\nclass QueryForm(forms.Form):\n query = forms.CharField(\n label='',\n ...
python
chosen
[ { "from": "system", "value": "Put cutline map in 26915\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom osgeo import ogr\nfrom osgeo import osr\nfrom glob import glob\nimport os.path\n\ndriver = ogr.GetDriverByName(\"ESRI Shapefile\")\nds = driver.CreateDataSource(\"summary-maps/cu...
python
chosen
[ { "from": "system", "value": "Write some more tests for the short nosetests parser\n" }, { "from": "human", "value": "#!/usr/bin/python\n################################################################################\n# \"THE BEER-WARE LICENSE\" (Revision 42):\n# <thenoviceoof> wrote this file....
python
chosen
[ { "from": "system", "value": "Add is_valid method for file sanitizer classes\n" }, { "from": "human", "value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import absolute_import, unicode_literals\n\nimport abc\n\nfrom ....
python
chosen
[ { "from": "system", "value": "Update to use OAuth, take in command line arguments and modify the imports to function from within the module.\n" }, { "from": "human", "value": "\"\"\"\nExample program for the Stream API. This prints public status messages\nfrom the \"sample\" stream as fast as po...
python
chosen
[ { "from": "system", "value": "Remove import of removed version module.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\n\nfrom .version import __version__\n\ntry:\n __ATRASU_SETUP__\nexcept:\n __ATRASU_SETUP__ = False\n\nif not __ATRASU_SETUP__:\n\tfrom . import spectra\n\tfro...
python
chosen
[ { "from": "system", "value": "Fix Bug in Test Assertion\n\nNeed to train myself better on red-green-refactor. The previous assert\nalways passed, because I wasn't triggering an actual Mock method. I had\nto change to verifying that the call is in the list of calls. I've\nverified that it fails when the call...
python
chosen
[ { "from": "system", "value": "Remove options until we actually need and understand them" }, { "from": "human", "value": "from ._overlap_wrapper import _computeOverlap\n\ndef compute_overlap(ilon, ilat, olon, olat, energy_mode=True, reference_area=1.):\n \"\"\"\n Compute the overlap between...
python
chosen
[ { "from": "system", "value": "Raise error when there is no term to search for\n" }, { "from": "human", "value": "\"\"\"Package command line interface.\"\"\"\n\nimport click\n\nfrom .curse import Game, Mod\n\n\n# Static data\nMINECRAFT = {'id': 432, 'name': 'Minecraft'}\n\n\n@click.group()\ndef c...
python
chosen
[ { "from": "system", "value": "Implement __str__ for proper printing in admin\n" }, { "from": "human", "value": "from django.db import models\n\n\nclass QuestionGroup(models.Model):\n heading = models.TextField()\n text = models.TextField(blank=True)\n date_added = models.DateTimeField(a...
python
chosen
[ { "from": "system", "value": "Add basic logging to ip_getters\n" }, { "from": "human", "value": "import base\nimport getters\n\nALL_CLASSES= base.BaseIpGetter.__subclasses__()\nALL= [x() for x in ALL_CLASSES]\n\ndef get_ip():\n import random\n remaining= ALL[:]\n while remaining:\n ...
python
chosen
[ { "from": "system", "value": "Use `with` syntax to open file\n" }, { "from": "human", "value": "import base64, os\n\ndef get_content(texts):\n\n if isinstance(texts, str) or isinstance(texts, unicode):\n file_path = texts\n with open(file_path, 'r') as f:\n return lis...
python
chosen
[ { "from": "system", "value": "Make find_pcts() function that can repetitively run.\n" }, { "from": "human", "value": "from deuces.deuces import Card, Deck\nfrom convenience import who_wins\n\np1 = [Card.new('As'), Card.new('Ac')]\np2 = [Card.new('Ad'), Card.new('Kd')]\nwin_record = []\n\nfor i i...
python
chosen
[ { "from": "system", "value": "Move pages to root URL\n\nFixes #1\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*- #\n\nAUTHOR = 'Glowstone Organization'\nSITENAME = 'Glowstone'\nSITEURL = ''\n\nPATH = 'content'\n\nTIMEZONE = 'UTC'\n\nDEFAULT_LANG = 'en'\n\n# Feed...
python
chosen
[ { "from": "system", "value": "Add another note about caching.\n" }, { "from": "human", "value": "import os\nimport morepath\nimport jinja2\n\n\nclass Jinja2App(morepath.App):\n pass\n\n\n@Jinja2App.setting_section(section='jinja2')\ndef get_setting_section():\n return {\n 'auto_relo...
python
chosen
[ { "from": "system", "value": "Exit density inversion test if gsw is not available.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\" Check density inversion QC test\n\"\"\"\n\nfrom numpy import ma\n\nfrom cotede.qctests import density_inversion\n\n\ndef ...
python
chosen
[ { "from": "system", "value": "Fix parsing make with || on line.\n" }, { "from": "human", "value": "# vim: set ts=4 sw=4 et: coding=UTF-8\n\nfrom rpmsection import Section\n\n\nclass RpmBuild(Section):\n \"\"\"\n Replace various troublemakers in build phase\n \"\"\"\n\n def add(se...
python
chosen
[ { "from": "system", "value": "Write the error and output files with the galaxy name and in the right folder\n" }, { "from": "human", "value": "\nimport os\n\n'''\nSubmits a job for every sample defined in the info dict\n'''\n\nscript_path = \"/lustre/home/ekoch/code_repos/BaSiCs/Examples/THINGS/...
python
chosen
[ { "from": "system", "value": "common: Update mimetype to content_type here, too.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom django.template import RequestContext, loader\nfrom django.conf import settings\nfrom django.core.exceptions import PermissionDenied\nfrom django.ht...
python
chosen
[ { "from": "system", "value": "Replace Object everywhere, not just the class definition.\n" }, { "from": "human", "value": "\"\"\"\nThe data models\n\"\"\"\n\nclass Repository(object):\n def __init__(self, base_url, identifier):\n self.base_url = base_url\n self.identifier = iden...
python
chosen
[ { "from": "system", "value": "tests/basics: Add test for set.difference_update with arg being itself.\n" }, { "from": "human", "value": "l = [1, 2, 3, 4]\ns = set(l)\nouts = [s.difference(),\n s.difference({1}),\n s.difference({1}, [1, 2]),\n s.difference({1}, {1, 2}, {2, 3}...
python
chosen
[ { "from": "system", "value": "Make the last function also a generator, so that the explanation flows better\n" }, { "from": "human", "value": "#!/usr/bin/env python\nimport sys, operator, string\n\ndef characters(filename):\n for line in open(filename):\n for c in line:\n yi...
python
chosen
[ { "from": "system", "value": "Remove redundant ws accept replies\n\nIt's only relevent on connection\n" }, { "from": "human", "value": "from channels.auth import channel_session_user_from_http, channel_session_user\nfrom django.utils import timezone\n\nfrom foodsaving.subscriptions.models import...
python
chosen
[ { "from": "system", "value": "Allow 'hello' test package to be used unpackaged\n" }, { "from": "human", "value": "import pkg_resources\n\nversion = pkg_resources.require(__name__)[0].version\n\ndef greet(name='World'):\n print \"Hi, %s! -- from version %s of %s\" % (name, version, __name__)\n...
python
chosen
[ { "from": "system", "value": "Fix test for generic plugins\n" }, { "from": "human", "value": "import pytest\n\nfrom detectem.core import MATCHERS\nfrom detectem.plugin import load_plugins, GenericPlugin\nfrom .utils import create_har_entry\n\n\nclass TestGenericPlugin(object):\n @pytest.fixtu...
python
chosen
[ { "from": "system", "value": "Change password hasher for tests for faster tests\n" }, { "from": "human", "value": "from seed_stage_based_messaging.settings import * # flake8: noqa\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = 'TESTSEKRET'\n\n# SECURITY WARN...
python
chosen
[ { "from": "system", "value": "Use os.urandom instead of OpenSSL.rand.bytes\n\nFollows suggestion in pyOpenSSL changelog https://github.com/pyca/pyopenssl/blob/1eac0e8f9b3829c5401151fabb3f78453ad772a4/CHANGELOG.rst#backward-incompatible-changes-1" }, { "from": "human", "value": "import binascii\n...
python
chosen
[ { "from": "system", "value": "Add version 0.17.1 of scikit-learn.\n" }, { "from": "human", "value": "from spack import *\n\nclass PyScikitLearn(Package):\n \"\"\"\"\"\"\n homepage = \"https://pypi.python.org/pypi/scikit-learn\"\n url = \"https://pypi.python.org/packages/source/s/sc...
python
chosen
[ { "from": "system", "value": "Add LDAP version to depend on config instead\n" }, { "from": "human", "value": "# Handles queries to the LDAP backend\n# Reads the LDAP server configuration from a JSON file\n\nimport json\nimport ldap\n\nfirst_connect = True\n# The default config filename\nconfig_f...
python
chosen
[ { "from": "system", "value": "Remove test print and use better practice to get path of gen.py\n" }, { "from": "human", "value": "\"\"\"\nCLI Entry point for respawn\n\"\"\"\n\nfrom docopt import docopt\nfrom schema import Schema, Use, Or\nfrom subprocess import check_call, CalledProcessError\nfr...
python
chosen
[ { "from": "system", "value": "Fix test in Ubuntu 20.04.\n" }, { "from": "human", "value": "import os\n\nimport testinfra.utils.ansible_runner\n\ntestinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(\n os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')\n\ndef test_service_elasti...
python
chosen
[ { "from": "system", "value": "Change l10n_ch_payment_slip version to v 11.0\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# © 2012-2016 Camptocamp SA\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n{'name': 'Switzerland - Payment Slip (BVR/ESR)',\n 'summary': 'Pri...
python
chosen
[ { "from": "system", "value": "Remove poor way of doing default styles\n\nSigned-off-by: Robert Deaton <eb00a885478926d5d594195591fb94a03acb1062@udel.edu>\n" }, { "from": "human", "value": "import spyral\nimport pygame\n\ndef init():\n spyral.event.init()\n pygame.init()\n pygame.font.in...
python
chosen
[ { "from": "system", "value": "Raise with endpoint when duplicated.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom electro.errors import ResourceDuplicatedDefinedError\n\nclass API(object):\n\n def __init__(self, app=None, decorators=None,\n catch_all_404s=None):...
python
chosen
[ { "from": "system", "value": "Update license and bump to 0.2.8\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n__title__ = 'pyhn'\n__version__ = '0.2.7'\n__author__ = 'Geoffrey Lehée'\n__license__ = 'AGPL3'\n__copyright__ = 'Copyright 2014 Geoffrey Lehée'\n" ...
python
chosen
[ { "from": "system", "value": "Make the openquake namespace compatible with old setuptools\n\n\nFormer-commit-id: b1323f4831645a19d5e927fc342abe4b319a76bb [formerly 529c98ec0a7c5a3fefa4da6cdf2f6a58b5487ebc] [formerly 529c98ec0a7c5a3fefa4da6cdf2f6a58b5487ebc [formerly e5f4dc01e94694bf9bfcae3ecd6eca34a33a24eb]...
python
chosen