conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix README filename; increment version\n" }, { "from": "human", "value": "import os\nfrom setuptools import find_packages, setup\n\nROOT = os.path.abspath(os.path.dirname(__file__))\n\nsetup(\n name = 'django-hookbox',\n version = '0.3',\n description = 'In...
python
chosen
[ { "from": "system", "value": "Simplify installation with package.json info\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nimport json\n\ndef read_from_package():\n with open('package.json', 'r') as f:\n pkg = json.load(f)\n return dict(version=pk...
python
chosen
[ { "from": "system", "value": "Fix console_script out of date after branch reconstruction.\n" }, { "from": "human", "value": "from setuptools import setup\n\npackages = [\n 'cortex', 'cortex._lib', 'cortex.built_ins', 'cortex._lib.data',\n 'cortex.built_ins.datasets', 'cortex.built_ins.mode...
python
chosen
[ { "from": "system", "value": "Comment out discord.py for now\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n\nfrom setuptools import setup, find_packages\n\nrequires = [\n \"equations (>=1.0,<2.0)\",\n \"discord.py (>=1.0,<2.0)\",\n \"sqlalchemy (>=1.2,<2.0)\",\n \"psycop...
python
chosen
[ { "from": "system", "value": "Bump pyyaml from 3.12 to 5.1\n\nBumps [pyyaml](https://github.com/yaml/pyyaml) from 3.12 to 5.1.\n- [Release notes](https://github.com/yaml/pyyaml/releases)\n- [Changelog](https://github.com/yaml/pyyaml/blob/master/CHANGES)\n- [Commits](https://github.com/yaml/pyyaml/compare/3....
python
chosen
[ { "from": "system", "value": "Change version to 1.0.0.dev4; not ready for official release yet\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\nfrom codecs import open # To use a consistent encoding\nfrom os import path\n\nhere = path.abspath(path.dirname(__file__...
python
chosen
[ { "from": "system", "value": "Fix tfx-bsl error due to pyarrow package version requirement.\n\nChange-Id: Ice7d39ccb0be84b36482c93b7de4b113fb1e7f82\n" }, { "from": "human", "value": "# Lint as: python3\n\n# Copyright 2020 Google LLC.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Li...
python
chosen
[ { "from": "system", "value": "Update links from Github to Gitlab following project move.\n" }, { "from": "human", "value": "# :coding: utf-8\n# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips\n# :license: See LICENSE.txt.\n\ntry:\n from setuptools import setup\nexcept ImportError:\n ...
python
chosen
[ { "from": "system", "value": "Apply same fix as in 77a463b50a\n\nSigned-off-by: Teodor-Dumitru Ene <2853baffc346a14b7885b2637a7ab7a41c2198d9@gmail.com>\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name=\"pptrees\",\n version=\"0.0.2\",\n description=\"Para...
python
chosen
[ { "from": "system", "value": "Change URL to new forked repo\n" }, { "from": "human", "value": "#!/usr/bin/env python2\n\nfrom setuptools import setup, find_packages\n\n\ndef included_package(p):\n\treturn p.startswith('spacq.') or p == 'spacq'\n\n\nsetup(\n\tname='SpanishAcquisition',\n\tversion...
python
chosen
[ { "from": "system", "value": "Change email, remove zip_safe=False and \"upgrade\" us to Beta.\n" }, { "from": "human", "value": "import os\nimport os.path\nimport sys\n\nfrom setuptools import find_packages, setup\n\nrequirements = ['parse>=1.1.5']\nmajor, minor = sys.version_info[:2]\nif major ...
python
chosen
[ { "from": "system", "value": "Fix install error on python 2.7\n" }, { "from": "human", "value": "#!/usr/bin/env python3\n# encoding: UTF-8\n\n\"\"\"Build tar.gz for pygubu\n\nNeeded packages to run (using Debian/Ubuntu package names):\n\n python3-tk\n\"\"\"\nimport os\n\nimport pygubu\n\ntry:...
python
chosen
[ { "from": "system", "value": "Add some mandatory and semi-mandatory dependencies\n" }, { "from": "human", "value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages\n\n\nsetup(\n name='couchforms',\n version='0.0.4',\n description='Dimagi Couch Forms for Django',\n ...
python
chosen
[ { "from": "system", "value": "Prepare to release on PyPI\n\n[ci skip]\n" }, { "from": "human", "value": "from setuptools import setup, find_packages\n\nsetup(\n name=\"cybox\",\n version=\"1.0b1\",\n author=\"CybOX Project, MITRE Corporation\",\n author_email=\"cybox@mitre.org\",\n ...
python
chosen
[ { "from": "system", "value": "Replace pil with Pillow in python package requirements\n\nDebian package python-pil does install Pillow, the alive fork of dead\nPIL project. When, however, pil is specified as package dependency in\nsetup.py, and python-ev3dev is installed with either\n`easy_install python-ev3...
python
chosen
[ { "from": "system", "value": "Bump version number to 0.2.2\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nversion = '0.2.1'\n\ndef read(fname):\n return open(os.path.join(os.path.dirname(__file__), fname)).read()\n\nsetup(\n name='django-templa...
python
chosen
[ { "from": "system", "value": "Update dependency to Core v26\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name = \"OpenFisca-Country-Template\",\n version = \"3.6.0\",\n author = \"OpenFisca Team\",\n author_emai...
python
chosen
[ { "from": "system", "value": "Prepare for upcoming release by fixing the version number syntax.\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\n\nfrom setuptools import setup, find_packages\n\n\ndef read(fname):\n return open(os.path.join(os.pat...
python
chosen
[ { "from": "system", "value": "Add generic Python 3 trove classifier\n" }, { "from": "human", "value": "from setuptools import setup\n\n\nsetup(\n name='tangled.session',\n version='0.1a3.dev0',\n description='Tangled session integration',\n long_description=open('README.rst').read(),...
python
chosen
[ { "from": "system", "value": "Move sphinx requirement into `extras`\n" }, { "from": "human", "value": "import os\nfrom setuptools import setup, find_packages\n\nwith open(os.path.join(os.path.dirname(__file__), 'VERSION')) as v_file:\n version = v_file.read().strip()\n\nwith open(os.path.join...
python
chosen
[ { "from": "system", "value": "Upgrade tangled 1.0a10 => 1.0a11\n" }, { "from": "human", "value": "from setuptools import setup, PEP420PackageFinder\n\n\nsetup(\n name='tangled.web',\n version='1.0a11.dev0',\n description='RESTful Web Framework',\n long_description=open('README.rst')....
python
chosen
[ { "from": "system", "value": "Move requests pin to versions.cfg in buildout\n\n\n" }, { "from": "human", "value": "import os\n\nfrom setuptools import setup, find_packages\n\nhere = os.path.abspath(os.path.dirname(__file__))\nREADME = open(os.path.join(here, 'README.txt')).read()\nCHANGES = open...
python
chosen
[ { "from": "system", "value": "Increment version for memory stores\n" }, { "from": "human", "value": "from os import path\nfrom setuptools import setup\n\n\n# Utility function to read the README file.\n# Used for the long_description. It's nice, because now 1) we have a top level\n# README file ...
python
chosen
[ { "from": "system", "value": "Add pytest-mock to the dependencies\n" }, { "from": "human", "value": "from setuptools import setup\n\nsetup(\n name='webcomix',\n version=1.3,\n description='Webcomic downloader',\n long_description='webcomix is a webcomic downloader that can additional...
python
chosen
[ { "from": "system", "value": "[tests/traffic] Fix tests for module traffic\n" }, { "from": "human", "value": "import mock\nimport unittest\n\nimport tests.mocks as mocks\n\nfrom bumblebee.modules.traffic import Module\n\nclass TestTrafficModule(unittest.TestCase):\n def setUp(self):\n ...
python
chosen
[ { "from": "system", "value": "Add a decorator to time out long-running functions.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\"\"\"Utility functions for PyTips.\"\"\"\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\nfrom __future__ import absolute...
python
chosen
[ { "from": "system", "value": "Copy reg file names into text file\n" }, { "from": "human", "value": "\n\n\"\"\"\nTake evt3 file and use region files to subtract off sources that are already known - image will have lots of holes\nGoals by Friday 6/31 - Get script working for one image at a time\n\...
python
chosen
[ { "from": "system", "value": "Use custom reports backend for test DB in Jenkins\n\nAs Django test runner does not support replica DBs (MIRROR setting\njust redirects to use the other connection), change the default\nconnection to use the custom engine when running in jenkins.\n\nTests fail during BST due to...
python
chosen
[ { "from": "system", "value": "Fix to the pressure sensor\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n\nimport sys\nfrom sense_hat import SenseHat\n#add the project folder to pythpath\nsys.path.append('../../')\n\nfrom library.components.SensorModule import SensorModule as Sensor\...
python
chosen
[ { "from": "system", "value": "Add test class for grouping tests\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nUnittests for csvnc module\n\n\"\"\"\n\nimport os\nimport pytest\nfrom csvnc import csvnc\n\n\ndef test_generated_file_should_have_extention_nc():\n data_file = 'd...
python
chosen
[ { "from": "system", "value": "[qt] Set application name to \"Lunasa Prismriver\"\n\nThat value will be used as WM_CLASS of application.\n" }, { "from": "human", "value": "import sys\n\nfrom PyQt5.QtGui import QIcon\n\nfrom PyQt5.QtWidgets import QApplication\n\nfrom prismriver.qt.window import M...
python
chosen
[ { "from": "system", "value": "Make pycrest mesh viz more capable\n" }, { "from": "human", "value": "import matplotlib.pyplot as plt\nfrom matplotlib.pyplot import triplot\nfrom mpl_toolkits.mplot3d import Axes3D\n\nfrom pycrest.mesh import Mesh2d\n\n\ndef plot_triangulation(tri: Mesh2d, standalo...
python
chosen
[ { "from": "system", "value": "Check if it is None before continuing\n\n" }, { "from": "human", "value": "from discord.ext import commands\nfrom .utils import checks\nimport asyncio\nimport discord\n\nimport web.wsgi\nfrom django.utils import timezone\nfrom django.db import models\nfrom django.ut...
python
chosen
[ { "from": "system", "value": "Fix stupid typo in urllib\n" }, { "from": "human", "value": "__author__ = 'Casey Dunham'\n__version__ = \"0.1.0\"\n\n\nimport urllib\nimport urllib2\nimport json\n\n\nPWNED_API_URL = \"https://haveibeenpwned.com/api/breachedaccount/%s\"\n\n\nclass InvalidEmail(Excep...
python
chosen
[ { "from": "system", "value": "Fix failing tests for captured output in teardown\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\ndef pytest_runtest_logreport(report):\n \"\"\"Overwrite report by removing any captured stderr.\"\"\"\n # print(\"PLUGIN SAYS -> report -> {0}\".forma...
python
chosen
[ { "from": "system", "value": "Add basic handling of incoming bids and offers.\n" }, { "from": "human", "value": "import threading\nimport socket\nimport SocketServer\n\nmessages = []\n\n\nclass ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):\n\n def handle(self):\n try:\n ...
python
chosen
[ { "from": "system", "value": "Add filtering options to events\n" }, { "from": "human", "value": "from django_filters import FilterSet, CharFilter, IsoDateTimeFilter\nfrom . import models\n\n\nclass EventFilterSet(FilterSet):\n class Meta:\n model = models.Event\n fields = (\n ...
python
chosen
[ { "from": "system", "value": "Fix __all__ import for ubiquiti\n" }, { "from": "human", "value": "from netmiko.ubiquiti.edge_ssh import UbiquitiEdgeSSH\nfrom netmiko.ubiquiti.edgerouter_ssh import UbiquitiEdgeRouterSSH\nfrom netmiko.ubiquiti.unifiswitch_ssh import UbiquitiUnifiSwitchSSH\n\n__all_...
python
chosen
[ { "from": "system", "value": "Update the schedules times and days\n" }, { "from": "human", "value": "import json\n\nfrom buffer.response import ResponseObject\n\nPATHS = {\n 'GET_PROFILES': 'profiles.json',\n 'GET_PROFILE': 'profiles/%s.json',\n 'GET_SCHEDULES': 'profiles/%s/schedules.json',\...
python
chosen
[ { "from": "system", "value": "Add check for folder to save checkpoints\n" }, { "from": "human", "value": "import tensorflow as tf\nimport driving_data\nimport model\n\nsess = tf.InteractiveSession()\n\nloss = tf.reduce_mean(tf.square(tf.sub(model.y_, model.y)))\ntrain_step = tf.train.GradientDes...
python
chosen
[ { "from": "system", "value": "Set fuzzer params to zero for now\n" }, { "from": "human", "value": "switch_failure_rate = 0.05\nswitch_recovery_rate = 0.05\ndataplane_drop_rate = 0.0\ndataplane_delay_rate = 0.0\ncontrolplane_block_rate = 0.0\ncontrolplane_unblock_rate = 1.0\nofp_message_receipt_r...
python
chosen
[ { "from": "system", "value": "Revert 273986 \"Remove failing expectations for pixel tests.\"\n\nRe-enable the failing expectations for the Pixel.CSS3DBlueBox test.\nThe <meta viewport> tag added to this test is causing failures on some\ndesktop bots. See Issue 368495.\n\n> Remove failing expectations for pi...
python
chosen
[ { "from": "system", "value": "Add test for complex indexing\n" }, { "from": "human", "value": "import scipy.interpolate\nimport numpy as np\n\nimport naturalneighbor\n\n\ndef test_output_size_matches_scipy():\n points = np.random.rand(10, 3)\n values = np.random.rand(10)\n\n grid_ranges...
python
chosen
[ { "from": "system", "value": "Move smll and dcm to baseline devices\n" }, { "from": "human", "value": "# vim: sw=4 ts=4 sts expandtab smarttab\n# HXN step-scan configuration\n\nimport hxntools.scans\nfrom bluesky.global_state import get_gs\n\ngs = get_gs()\n\nhxntools.scans.setup()\nct = hxntool...
python
chosen
[ { "from": "system", "value": "1.3.2dev: Remove use of deprecated `assertEquals`\n\n\ngit-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@15981 af82e41b-90c4-0310-8c96-b1721e28e2e2\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2017 Edgewall Software\n# All rights...
python
chosen
[ { "from": "system", "value": "Add generator Lookup which emulates a dictionary lookup for generators\n" }, { "from": "human", "value": "from operator import attrgetter\nfrom .base import logger, DependentGenerator\n\n__all__ = ['ExtractAttribute']\n\n\nclass ExtractAttribute(DependentGenerator):...
python
chosen
[ { "from": "system", "value": "Update support for new django-jinja versions. (backward incompatible)\n" }, { "from": "human", "value": "from django import template\nregister = template.Library()\n\nfrom .. import sr as sr_func\n\n@register.simple_tag(name='sr')\ndef sr_tag(key, *args, **kwargs):\...
python
chosen
[ { "from": "system", "value": "Remove looping through items and appending them to list.\n" }, { "from": "human", "value": "import sys\nimport boto3\n\nBUCKET_NAME = 'mitLookit'\n\ndef get_all_study_attachments(study_uuid):\n s3 = boto3.resource('s3')\n\n bucket = s3.Bucket(BUCKET_NAME)\n ...
python
chosen
[ { "from": "system", "value": "Switch to memcachier dev plan\n" }, { "from": "human", "value": "import logging\nimport os\nimport json\n\nimport TileStache\n\nif 'AWS_ACCESS_KEY_ID' in os.environ and \\\n 'AWS_SECRET_ACCESS_KEY' in os.environ:\n cache = {\n \"name\": \"S3\",\n...
python
chosen
[ { "from": "system", "value": "Disable failing recipe in CRON tests\n" }, { "from": "human", "value": "\"\"\"\nGet the average and total runtime for build platforms and types.\n\n.. code-block:: bash\n\n adr config_durations [--branch <branch>]\n\"\"\"\nfrom __future__ import absolute_import, ...
python
chosen
[ { "from": "system", "value": "Fix test failing on python 3\n" }, { "from": "human", "value": "#!/usr/bin/env python\n# vim:fileencoding=utf-8\n# License: Apache 2.0 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>\n\nfrom __future__ import absolute_import, division, print_function, unicode...
python
chosen
[ { "from": "system", "value": "Define variables for the DB name, host, etc. so they can be imported\n" }, { "from": "human", "value": "import sys\nimport psycopg2\nimport os\nimport yaml\n\nif 'CATMAID_CONFIGURATION' in os.environ:\n path = os.environ['CATMAID_CONFIGURATION']\nelse:\n path ...
python
chosen
[ { "from": "system", "value": "Improve generate_tmp_file_path pytest command docs \n\n" }, { "from": "human", "value": "import os\n\n\ndef generate_tmp_file_path(tmpdir_factory,\n file_name_with_extension: str,\n tmp_dir_path: str = None) -> str...
python
chosen
[ { "from": "system", "value": "Delete live writing demo before loading new one\n" }, { "from": "human", "value": "\"\"\"Insert the demo into the codemirror site.\"\"\"\nfrom __future__ import print_function\n\nimport os\nimport fileinput\nimport shutil\n\nproselint_path = os.path.dirname(os.path....
python
chosen
[ { "from": "system", "value": "Add queryset for ordering memberships by activity\n" }, { "from": "human", "value": "from django.contrib.contenttypes import fields as contenttypes\nfrom django.db import models\n\n\nclass Membership(models.Model):\n created_by = models.ForeignKey(\n '...
python
chosen
[ { "from": "system", "value": "Add author field & autocomplete to annotation model+interface\n" }, { "from": "human", "value": "from urllib.parse import urlparse\nfrom django.db import models\nfrom django.urls import resolve, Resolver404\nfrom annotator_store.models import BaseAnnotation\nfrom dj...
python
chosen
[ { "from": "system", "value": "Add bounds checking to BaseHandler.read()\n" }, { "from": "human", "value": "from collections import OrderedDict\n\n\nclass BaseHandler:\n def __init__(self, file, file_name):\n self.file = file\n self.file_name = file_name\n self.info = Orde...
python
chosen
[ { "from": "system", "value": "Add debugging setting to local_settings\n" }, { "from": "human", "value": "__author__ = 'peter'\n\n# Build paths inside the project like this: os.path.join(BASE_DIR, ...)\nimport os\nBASE_DIR = os.path.dirname(os.path.dirname(__file__))\n\n# Database\n# https://docs...
python
chosen
[ { "from": "system", "value": "Allow using register_enum as a decorator\n\nBy returning the original class instance, it'd be possible to use `enum_wrapper.register_enum` as a decorator, making the usage cleaner while staying backwards compatible:\r\n\r\n```python\r\n@enum_wrapper.register_enum\r\nclass MyAwe...
python
chosen
[ { "from": "system", "value": "Add a gunicorn server adpter\n" }, { "from": "human", "value": "from typing import Dict, Any\n\n\nclass ServerAdapter:\n quiet = False\n\n def __init__(self, host: str='127.0.0.1', port: int=8080, **options) -> None:\n self.options = options\n se...
python
chosen
[ { "from": "system", "value": "Remove test content type media from RawContent\n" }, { "from": "human", "value": "from django.db import models\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom django import forms\n\nclass RawContent(mod...
python
chosen
[ { "from": "system", "value": "Use triple double quotes rather than single\n" }, { "from": "human", "value": "import json\nimport jsonschema\n\nfrom django.core.exceptions import ValidationError\n\n\n# Add path to required validator so we can get property name\ndef _required(validator, required, ...
python
chosen
[ { "from": "system", "value": "Add method to update a player's score\n" }, { "from": "human", "value": "from nameko.rpc import rpc, RpcProxy\n\n\nclass ScoreService(object):\n name = 'score_service'\n\n player_service = RpcProxy('players_service')\n\n @rpc\n def leaderboard(self):\n ...
python
chosen
[ { "from": "system", "value": "Fix missing colon in video url\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.urls import path\n# Views\nfrom . import views\n\n# Application namespace\napp_name = 'video'\n\nurlpatterns = [\n pa...
python
chosen
[ { "from": "system", "value": "Format URL patterns into more readable form.\n" }, { "from": "human", "value": "from django.conf.urls.defaults import *\n\nfrom shortwave.views import wave_list, wave_detail\n\n\nurlpatterns = patterns('',\n url(r'^$', wave_list, name='shortwave-wave-list'),\n ...
python
chosen
[ { "from": "system", "value": "Update example to new write_frames API.\n\n\n" }, { "from": "human", "value": "import numpy as np\nfrom scikits.audiolab import Format, Sndfile\n\nfilename = 'foo.wav'\n\n# Create some data to save as audio data: one second of stereo white noise\ndata = np.random.ra...
python
chosen
[ { "from": "system", "value": "Replace subprocess.Popen with check_output to avoid git zombies\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright (c) 2014, GEM Foundation.\n#\n# OpenQuake is free software: you can redistribute it...
python
chosen
[ { "from": "system", "value": "Update to new alabaster-driven nav sidebar\n" }, { "from": "human", "value": "from datetime import datetime\nimport os\nimport sys\n\nimport alabaster\n\n\n# Alabaster theme\nhtml_theme_path = [alabaster.get_path()]\n# Paths relative to invoking conf.py - not this s...
python
chosen
[ { "from": "system", "value": "Make ParseError a child of EMDSError.\n" }, { "from": "human", "value": "\"\"\"\nVarious parser-related exceptions.\n\"\"\"\n\nclass ParseError(Exception):\n \"\"\"\n Raise this when some unrecoverable error happens while parsing serialized\n market data.\n...
python
chosen
[ { "from": "system", "value": "Set depth for Lake Superior\n" }, { "from": "human", "value": "#!/usr/bin/env python\n\"\"\"\nReduced Gravity Shallow Water Model\nbased Matlab code by: Francois Primeau UC Irvine 2011\n\nKelsey Jordahl\nkjordahl@enthought.com\nTime-stamp: <Tue Apr 10 08:44:50 EDT 2...
python
chosen
[ { "from": "system", "value": "Join with a space, duh\n" }, { "from": "human", "value": "import random\n\nfrom helga.plugins import command\n\n\nRESPONSES = [\n 'There is no hope for {thing}, {nick}',\n 'It looks ok to me...',\n 'Turning {thing} off and back on again',\n 'I really wis...
python
chosen
[ { "from": "system", "value": "Add deprecated field in students\n" }, { "from": "human", "value": "from apps.teilar.models import Departments\nfrom django.contrib.auth.models import User\nfrom django.db import models\n\nclass UserProfile(models.Model):\n user = models.ForeignKey(User, unique =...
python
chosen
[ { "from": "system", "value": "Revert \"Hago un strip del output de subprocess\"\n\nThis reverts commit f5f21d78d87be641617a7cb920d0869975175e58.\n" }, { "from": "human", "value": "#! coding: utf-8\n\nimport subprocess\nimport nose.tools as nt\nfrom tests import TestPortalAndino\n\n\nclass TestFi...
python
chosen
[ { "from": "system", "value": "Sort the disc list by timestamp.\n" }, { "from": "human", "value": "\"\"\"DJRivals database updater.\"\"\"\nfrom random import shuffle\nfrom time import localtime, sleep, strftime, time\n\nimport pop\nimport dj\nimport image\nimport html\n\n\ndef continuous():\n ...
python
chosen
[ { "from": "system", "value": "Fix non unicode chars problem\n" }, { "from": "human", "value": "try:\n from StringIO import StringIO\nexcept ImportError:\n from io import StringIO\nimport csv\n\nfrom zou.app import config\nfrom flask import make_response\nfrom slugify import slugify\n\n\nde...
python
chosen
[ { "from": "system", "value": "Fix redis lock, use SETNX\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nfrom kvs import CacheKvs\n\n\nclass Locker(object):\n \"\"\"\n locker for move the locker\n \"\"\"\n\n LOCKER_KEY = 'locker'\n EXPIRES = 5 # 5 sec\n\n def __init...
python
chosen
[ { "from": "system", "value": "Use asyncio.run() to run the test client.\n\nThis makes for cleaner code.\n" }, { "from": "human", "value": "import asyncio\nimport platform\nimport time\n\nfrom zeep import AsyncClient\nfrom zeep.cache import InMemoryCache\nfrom zeep.transports import AsyncTranspor...
python
chosen
[ { "from": "system", "value": "Add footers the comment discusses.\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 auth...
python
chosen
[ { "from": "system", "value": "Fix link detection when target is itself a symlink\n\nThis shows up on OSX where /tmp is actually a symlink to /private/tmp.\n" }, { "from": "human", "value": "\"\"\"\nMisc utility functions.\n\"\"\"\n\nimport os.path\n\nfrom dotfiles.compat import islink, realpath\...
python
chosen
[ { "from": "system", "value": "Fix permission checking for entity proxy view\n" }, { "from": "human", "value": "import django\n\nimport utils\nfrom features import gestalten, groups\n\n\nclass Entity(django.views.generic.View):\n def get(self, request, *args, **kwargs):\n try:\n ...
python
chosen
[ { "from": "system", "value": "Make solution more efficient by only testing odd numbers\n" }, { "from": "human", "value": "def prime_factors(n):\n factors = []\n factor = 2\n while n != 1:\n while n % factor == 0:\n factors += [factor]\n n //= factor\n ...
python
chosen
[ { "from": "system", "value": "Remove uses of using() from migrations\n\nThis hardcoded the db_alias fetched from schema_editor and forces django\nto try and migrate any second database you use, rather than routing to\nthe default database. In testing a build from scratch, these do not\nappear needed.\n\nUs...
python
chosen
[ { "from": "system", "value": "Add custom NRW redirect url " }, { "from": "human", "value": "from django.conf.urls.defaults import patterns\n\n\nurlpatterns = patterns('fragdenstaat_de.views',\n (r'^presse/(?P<slug>[-\\w]+)/$', 'show_press', {}, 'fds-show_press'),\n)\n" }, { "from": "g...
python
chosen
[ { "from": "system", "value": "Use manager method for view articles" }, { "from": "human", "value": "from django.shortcuts import render\n\nfrom foiidea.models import Article\n\n\ndef index(request):\n return render(request, 'foiidea/index.html', {\n 'object_list': Article.objects.all()...
python
chosen
[ { "from": "system", "value": "Add user to db.session only when it has been created\n" }, { "from": "human", "value": "from alfred_db.models import User\nfrom flask import current_app\nfrom github import Github\nfrom requests_oauth2 import OAuth2\n\nfrom .database import db\n\n\ndef get_shell():\...
python
chosen
[ { "from": "system", "value": "Fix template for docker command line\n" }, { "from": "human", "value": "import os\nimport subprocess\n\n\ndef env(image):\n \"\"\"Return environment of image. \"\"\"\n\n out = docker('inspect', '-f', '{{.Config.Env}}', image)\n return dict(map(lambda x: x.s...
python
chosen
[ { "from": "system", "value": "Add shebang to python server\n" }, { "from": "human", "value": "import socket\nimport serial.tools.list_ports\nimport serial\n\n\nports = list(serial.tools.list_ports.comports())\narduino_port = next((port for port in ports if \"Arduino\" in port.description), None)...
python
chosen
[ { "from": "system", "value": "Make dates in the ServiceForm optional.\n" }, { "from": "human", "value": "'''\nCreated on 3.12.2011\n\n@author: xaralis\n'''\nfrom django import forms\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom boris.utils.widgets import SelectYearWidget\n\ncl...
python
chosen
[ { "from": "system", "value": "Add a test for pmids and update to new api.\n" }, { "from": "human", "value": "from indra.sources import rlimsp\n\n\ndef test_simple_usage():\n rp = rlimsp.process_pmc('PMC3717945')\n stmts = rp.statements\n assert len(stmts) == 6, len(stmts)\n for s in ...
python
chosen
[ { "from": "system", "value": "Replace dash to underscore for config\n" }, { "from": "human", "value": "from docutils.nodes import SkipNode\n\nfrom . import data_dictionary\nfrom . import database_diagram\n\n\ndef skip(self, node):\n _ = self\n _ = node\n raise SkipNode\n\n\ndef setup(ap...
python
chosen
[ { "from": "system", "value": "Implement Mage cards for The Grand Tournament\n" }, { "from": "human", "value": "from ..utils import *\n\n\n##\n# Secrets\n\n# Effigy\nclass AT_002:\n\tevents = Death(FRIENDLY + MINION).on(\n\t\tlambda self, minion: Summon(self.controller, RandomMinion(cost=minion.c...
python
chosen
[ { "from": "system", "value": "Update comments on the built-in file types\n" }, { "from": "human", "value": "import build_inputs\nfrom path import Path\n\nclass SourceFile(build_inputs.File):\n def __init__(self, name, source=Path.srcdir, lang=None):\n build_inputs.File.__init__(self, n...
python
chosen
[ { "from": "system", "value": "Kill child processes as well as shell process\n" }, { "from": "human", "value": "import sys\nimport os\nimport signal\n\n\nif sys.platform.startswith(\"win\"):\n def taskkill(pid):\n os.system('taskkill /F /PID {:d} /T >NUL 2>NUL'.format(pid))\nelse: # POSIX\n ...
python
chosen
[ { "from": "system", "value": "Fix freezing debug or not\n" }, { "from": "human", "value": "from flask_site import freezer, config\n\nif __name__ == '__main__':\n freezer.run(debug=config.get('debug')) # build and serve from build directory\n" }, { "from": "gpt", "value": "from fl...
python
chosen
[ { "from": "system", "value": "Remove vim header from source files\n\nChange-Id: I67a1ee4e894841bee620b1012257ad72f5e31765\n" }, { "from": "human", "value": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2013 Hewlett-Packard Development Company, L.P.\n# All Rights Reserved.\n#\n# Lic...
python
chosen
[ { "from": "system", "value": "Rename form BucketlistItem to Activity\n" }, { "from": "human", "value": "from flask_wtf import FlaskForm\nfrom wtforms import StringField, PasswordField, BooleanField, TextAreaField\nfrom wtforms.validators import DataRequired, Length, Email\n\n\nclass SignupForm(F...
python
chosen
[ { "from": "system", "value": "Fix tests for new index.\n" }, { "from": "human", "value": "import os\nimport unittest\nfrom application.default_settings import _basedir\nfrom application import app, db\n\n\nclass ManagerTestCase(unittest.TestCase):\n \"\"\" setup and teardown for the testing d...
python
chosen
[ { "from": "system", "value": "Update lazy helper to support the idea of a reset on bad state.\n" }, { "from": "human", "value": "# Lazy objects, for the serializer to find them we put them here\n\nclass LazyDriver(object):\n _driver = None\n\n @classmethod\n def get(cls):\n impor...
python
chosen
[ { "from": "system", "value": "Fix mistake in path in warning when config file is missing\n" }, { "from": "human", "value": "import ConfigParser\nimport os\nimport yaml\n\nclass Database(object):\n \"\"\" Generic class for handling database-related tasks. \"\"\"\n\n def select_config_for_en...
python
chosen
[ { "from": "system", "value": "Change replacement string of named entity filth\n" }, { "from": "human", "value": "from .base import Filth\n\n\nclass NamedEntityFilth(Filth):\n \"\"\"\n Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)\n \"\"\"\n ...
python
chosen