conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Fix index to list when there is no 2nd element\n"
},
{
"from": "human",
"value": "import sys\n\nimport numpy as np\nfrom IPython.core.display import Image\n\nimport praw\n\n\nreddit = praw.Reddit(\"BayesianMethodsForHackers\")\nsubreddit = reddit.get_subreddit( \"p... | python | chosen |
[
{
"from": "system",
"value": "Add hash and eq methods to Token\n"
},
{
"from": "human",
"value": "class Token:\n \"\"\"Representation of a single Token\"\"\"\n\n def __init__(self, _type, lexeme, literal=None):\n self.type = _type\n self.lexeme = lexeme\n self.literal ... | python | chosen |
[
{
"from": "system",
"value": "Use the same normlization for whole gif\n"
},
{
"from": "human",
"value": "import matplotlib\nmatplotlib.use('Agg')\n\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\n\nclass AnimatedGif:\n\n \"\"\" Setup various rendering things\n \... | python | chosen |
[
{
"from": "system",
"value": "Include timestamp in audit logs\n"
},
{
"from": "human",
"value": "import cherrypy\nimport logging\nfrom girder import auditLogger\nfrom girder.models.model_base import Model\nfrom girder.api.rest import getCurrentUser\n\n\nclass Record(Model):\n def initialize(s... | python | chosen |
[
{
"from": "system",
"value": "Set default max threads for multithreading to 3\n"
},
{
"from": "human",
"value": "\"\"\" Defining constants for tensorpy use \"\"\"\n\nDOWNLOADS_FOLDER = \"downloads_folder\" # Folder created for downloaded files\nMIN_W_H = 50 # Minimum width/height for classifyi... | python | chosen |
[
{
"from": "system",
"value": "Set an initial size and disallow resizing\n"
},
{
"from": "human",
"value": "from gi.repository import Gtk, GdkPixbuf, GLib\nimport cv2\n\nclass View(Gtk.Window):\n\tdef __init__(self, title, camera, interval=200):\n\t\tGtk.Window.__init__(self)\n\t\tself.set_title(... | python | chosen |
[
{
"from": "system",
"value": "Add comment to explain pagination handling\n"
},
{
"from": "human",
"value": "from future.standard_library import install_aliases\ninstall_aliases() # noqa\nfrom urllib.parse import urlparse\n\nfrom celery.task import Task\nfrom django.conf import settings\nfrom se... | python | chosen |
[
{
"from": "system",
"value": "Fix broken test since models new default ordering\n"
},
{
"from": "human",
"value": "from .. import factories\nfrom . import CoreFixturesTestCase\n\n\nclass AnalysisFactoryTestCase(CoreFixturesTestCase):\n\n def test_new_factory_with_Experiments(self):\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix up some issues with supporting schema migration\n"
},
{
"from": "human",
"value": "# Copyright (c) 2013 AnsibleWorks, Inc.\n# All Rights Reserved.\n\n\nfrom django.db import models\n\nclass ActivityStream(models.Model):\n '''\n Model used to describe activ... | python | chosen |
[
{
"from": "system",
"value": "Make sure timestamp of log message is UTC when it goes into DB\n"
},
{
"from": "human",
"value": "\nimport redis\nimport re\nfrom common import get_db\nfrom datetime import datetime\n\nMSGPATTERN = re.compile('^(\\w+)\\|(\\d)\\|([\\s\\S]*)$')\nCHANNEL = 'logfire'\n\... | python | chosen |
[
{
"from": "system",
"value": "Change the way we pass resolution to blender"
},
{
"from": "human",
"value": "__author__ = 'Xyene'\n\nimport bpy\nimport sys\nimport math\n\n\nbpy.context.scene.cycles.resolution_x = int(sys.argv[-5])\nbpy.context.scene.cycles.resolution_y = int(sys.argv[-4])\n\nfor... | python | chosen |
[
{
"from": "system",
"value": "Use pywsgi.py instead of wsgi (better chunked handling)\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nhttpbin.runner\n~~~~~~~~~~~~~~\n\nThis module serves as a command-line runner for httpbin, powered by\ngunicorn.\n\n\"\"\"\n\nimport sys\n\n... | python | chosen |
[
{
"from": "system",
"value": "Use set_request_property instead of subscriber to improve performance\n"
},
{
"from": "human",
"value": "\"\"\"\nsimplified mongodb integration\n\n\n1. Add two lines to app/__init__.py ( the import and the call to initialize_mongo_db )\n\n import python_mongodb\... | python | chosen |
[
{
"from": "system",
"value": "Add additional assertion that the file we uploaded is correct\n\nWe should pull back down the S3 bucket file and be sure it's the same, proving we used the boto3 API correctly. We should probably, at some point, also upload a _real_ zip file and not just a plaintext file.\n"
... | python | chosen |
[
{
"from": "system",
"value": "Use super() for great justice.\n"
},
{
"from": "human",
"value": "# Exception hierarchy for chef\n# Copyright (c) 2010 Noah Kantrowitz <noah@coderanger.net>\n\nclass ChefError(Exception):\n \"\"\"Top-level Chef error.\"\"\"\n\nclass ChefServerError(ChefError):\n ... | python | chosen |
[
{
"from": "system",
"value": "Sort by descending date created (new first)\n"
},
{
"from": "human",
"value": "from rest_framework import viewsets\nfrom . import serializers, models\n\n\nclass PrintJobViewSet(viewsets.ModelViewSet):\n serializer_class = serializers.PrintJobSerializer\n\n def... | python | chosen |
[
{
"from": "system",
"value": "Fix Attempted relative import beyond top-level package\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.contrib import admin\n\nfrom survey.models import Answer, Category, Question, Response, Survey\n\nfrom .actions import make_published\n\n... | python | chosen |
[
{
"from": "system",
"value": "Drop support for Django 1.6\n"
},
{
"from": "human",
"value": "try:\n from django.conf.urls import patterns # Django>=1.6\nexcept ImportError:\n from django.conf.urls.defaults import patterns # Django<1.6\n\nimport os\n\napp_dir = os.path.dirname(__file__)\n... | python | chosen |
[
{
"from": "system",
"value": "Add tests for DatabaseBase abstraction\n"
},
{
"from": "human",
"value": "from piper.db import DbCLI\n\nimport mock\n\n\nclass DbCLIBase(object):\n def setup_method(self, method):\n self.cli = DbCLI(mock.Mock())\n self.ns = mock.Mock()\n self... | python | chosen |
[
{
"from": "system",
"value": "Fix the 'contribution/all' or 'contribution/' URL.\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\nfrom django.views.generic.detail import DetailView\nfrom django.views.generic.list import ListView\n\nfrom .models import Contribution\n... | python | chosen |
[
{
"from": "system",
"value": "[REMOVE] Remove unused FormLogin in admin app\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User\nfrom django import forms\n\nfrom apps.categories.models import *\nfrom apps.books.models import *\n\nclass LoginForm(forms.ModelForm):\n ... | python | chosen |
[
{
"from": "system",
"value": "Test Utils: Cleans up the code\n"
},
{
"from": "human",
"value": "\"\"\"Utilities for tests.\n\"\"\"\nimport codecs\nimport codecs\nimport os\nimport re\n\n\ndef strip_ansi(string):\n \"\"\"Strip ANSI encoding from given string.\n \n Parameters\n -------... | python | chosen |
[
{
"from": "system",
"value": "Test is loaded CSS is applied\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nimport unittest\nfrom .base import FunctionalTestCase\nfrom .pages import game\n\nclass StylesheetTests(FunctionalTestCase):\n def test_color_css_loaded(self):\n self... | python | chosen |
[
{
"from": "system",
"value": "BUG: Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938)\n\nAIX needs to be told to use large file support at all times. Fixes parts of gh-15801."
},
{
"from": "human",
"value": "\ndef configuration(parent_package='',top_path=None):\n from numpy.dist... | python | chosen |
[
{
"from": "system",
"value": "Update http server to un-blocking\n"
},
{
"from": "human",
"value": "import eventlet\nimport os\nimport commands\nfrom eventlet import wsgi\nfrom paste.deploy import loadapp\n\n\ndef main():\n conf = \"conf/api-paste.ini\"\n appname = \"main\"\n commands.ge... | python | chosen |
[
{
"from": "system",
"value": "Initialize random sequence of words when starting training, so that words do not repeat\n"
},
{
"from": "human",
"value": "import logging\nimport random\n\n\nDIRECT = 'direct'\nREVERSE = 'reverse'\nLOG = logging.getLogger(__name__)\n\n\nclass Trainer:\n\n def __i... | python | chosen |
[
{
"from": "system",
"value": "Fix and extend test conditions\n"
},
{
"from": "human",
"value": "import os\nfrom indra.statements import *\nfrom indra.sources import ctd\nfrom indra.sources.ctd.processor import CTDChemicalGeneProcessor\n\nHERE = os.path.dirname(os.path.abspath(__file__))\n\n\ndef... | python | chosen |
[
{
"from": "system",
"value": "Fix Google Translator request & processing\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport time\nimport requests\n\n\ndef save_google_translation(queue, source_text, client_id, client_secret, translate_from='et', translate_to... | python | chosen |
[
{
"from": "system",
"value": "Update to dev version 0.14.1+dev20220804"
},
{
"from": "human",
"value": "\"\"\"The version number defined here is read automatically in setup.py.\"\"\"\n\n__version__ = \"0.14.0\"\n"
},
{
"from": "gpt",
"value": "\"\"\"The version number defined here is... | python | chosen |
[
{
"from": "system",
"value": "Update the required version of Celery\n"
},
{
"from": "human",
"value": "from setuptools import setup, find_packages\n\nPACKAGE_NAME = \"ReviewBot\"\nVERSION = \"0.1\"\n\n\nsetup(name=PACKAGE_NAME,\n version=VERSION,\n description=\"ReviewBot, the automate... | python | chosen |
[
{
"from": "system",
"value": "Fix columns not to be converted into str\n"
},
{
"from": "human",
"value": "from .parts import Column\n\n\ndef BETWEEN(expr1, expr2, expr3):\n return Column('%s BETWEEN %s AND %s' % (_actual_n(expr1), _actual_n(expr2), _actual_n(expr3)))\n\n\ndef CAST(type1, type... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with create_superuser method on UserManager\n"
},
{
"from": "human",
"value": "from django.utils import timezone\nfrom django.contrib.auth.models import BaseUserManager\n\nfrom model_utils.managers import InheritanceQuerySet\n\nfrom .conf import settings\n... | python | chosen |
[
{
"from": "system",
"value": "Handle missing value in predit rf\n"
},
{
"from": "human",
"value": "import numpy as np\nimport pandas as pd\nimport sys\nimport os\nfrom sklearn.externals import joblib\nfrom sklearn.ensemble import RandomForestClassifier\n\nscriptpath = os.path.dirname(os.path.rea... | python | chosen |
[
{
"from": "system",
"value": "Fix index. Caught by Tudor.\n"
},
{
"from": "human",
"value": "from .transition import Transition\n\n\nclass CircularBuffer(object):\n def __init__(self, capacity=100000):\n self.capacity = capacity\n self.memory = []\n self.position = 0\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Increase request buffer as workaround for stackoverflow in asyncio\n"
},
{
"from": "human",
"value": "from japronto import Application\nfrom services.articles import ArticleService\nfrom mongoengine import *\n\narticle_service = ArticleService()\n\ndef index(req):\n... | python | chosen |
[
{
"from": "system",
"value": "Set mongodb settings using config.py\n"
},
{
"from": "human",
"value": "\nimport pymongo\n\nconnection = pymongo.MongoClient(\"mongodb://localhost\")\ndb = connection.vcf_explorer\n\nimport database\nimport parse_vcf\nimport filter_vcf\nimport query\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Update pyramid example with longer description\n"
},
{
"from": "human",
"value": "\"\"\"\n====================\nBuild image pyramids\n====================\n\nThis example shows how to build image pyramids.\n\"\"\"\n\nimport numpy as np\nimport matplotlib.pyplot as p... | python | chosen |
[
{
"from": "system",
"value": "Add options for add date and tags.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Convert browser bookmark export (NETSCAPE-Bookmark-file-1 format) to json\n#\nfrom argparse import ArgumentParser\nfrom bs4 import BeautifulSoup\nfrom datetime import d... | python | chosen |
[
{
"from": "system",
"value": "Fix detect Git-LFS in tests\n"
},
{
"from": "human",
"value": "import email\nfrom os.path import dirname, join\n\nfrom django.utils import six\nfrom django_mailbox.models import Mailbox\n\nfrom feder.letters.signals import MessageParser\n\n\nclass MessageMixin(objec... | python | chosen |
[
{
"from": "system",
"value": "Add h5py on sciqnd ipython profile\n"
},
{
"from": "human",
"value": "import cPickle as pickle\nimport glob\nimport json\nimport math\nimport os\nimport sys\n\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport... | python | chosen |
[
{
"from": "system",
"value": "Add comments to item fields.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python2.7\n# -*- coding: utf-8 -*-\n\nimport scrapy\n\n\nclass Post(scrapy.Item):\n \"\"\"\n A model representing a single Reddit post.\n \"\"\"\n id = scrapy.Field()\n\n\ncla... | python | chosen |
[
{
"from": "system",
"value": "Add featured homepage initial fixture.\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\n\nfrom us_ignite.snippets.models import Snippet\n\n\nFIXTURES = [\n {\n 'slug': 'home-box',\n 'name': 'Up next:',\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix for IE 11 (Focus)\n\nIE presents itself as mozilla, so it trips on the bug.\n"
},
{
"from": "human",
"value": "\ndef ensureFocusHandler():\n JS(\"\"\"\n return (focusHandler !== null) ? focusHandler : (focusHandler =\n @{{createFocusHandler}}())... | python | chosen |
[
{
"from": "system",
"value": "Update check_requires_python and describe behavior in docstring\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport logging\nimport sys\n\nfrom pip._vendor import pkg_resources\nfrom pip._vendor.packaging import specifiers\nfrom pip._... | python | chosen |
[
{
"from": "system",
"value": "Return pre-built dockerfile to user\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nSciStack: the web app to build docker containers for reproducable science\n\n\n\"\"\"\nimport os\nimport flask\n\napp = flask.Flask(__name_... | python | chosen |
[
{
"from": "system",
"value": "Upgrade libchromiumcontent: Add support for acceptsFirstMouse.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nNODE_VERSION = 'v0.11.10'\nBASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'\nLIBCHROMIUMCONTENT_COMMIT = '607907ae... | python | chosen |
[
{
"from": "system",
"value": "Upgrade libchromiumcontent to fix generating node.lib\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport platform\nimport sys\n\nBASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'\nLIBCHROMIUMCONTENT_COMMIT = 'e4b283c222365... | python | chosen |
[
{
"from": "system",
"value": "Set hash rounds back to 100000\n\n- Installed python-m2crypto package which speeds up pbkdf2 enough that\n 100K rounds is fine again.\n"
},
{
"from": "human",
"value": "# Store various constants here\n\n# Maximum file upload size (in bytes).\nMAX_CONTENT_LENGTH = 1... | python | chosen |
[
{
"from": "system",
"value": "Simplify test execution to restore coverage measurement\n"
},
{
"from": "human",
"value": "import unittest\nimport sys\nimport subprocess\n\n\nif __name__ == '__main__':\n if len(sys.argv) > 1:\n unittest.main(module='flask_api.tests')\n else:\n ... | python | chosen |
[
{
"from": "system",
"value": "Use stemmed Kucera Francis for Enrichment\n"
},
{
"from": "human",
"value": "__author__ = 's7a'\n\n# All imports\nfrom extras import KuceraFrancis\nfrom resource import Resource\nfrom os import path\n\n\n# The Kucera Francis enrichment class\nclass KuceraFrancisEnri... | python | chosen |
[
{
"from": "system",
"value": "Check explicit that next step is None\n"
},
{
"from": "human",
"value": "class InvalidData(Exception):\n \"\"\"\n Raised for by step validation process\n \"\"\"\n pass\n\n\nclass Step(object):\n \"\"\"\n A single step in a multistep process\n \"... | python | chosen |
[
{
"from": "system",
"value": "Add support for configuring data views and reports\n\n"
},
{
"from": "human",
"value": "from lava_server.extension import LavaServerExtension\n\n\nclass DashboardExtension(LavaServerExtension):\n\n @property\n def app_name(self):\n return \"dashboard_ap... | python | chosen |
[
{
"from": "system",
"value": "Initialize osprofiler in WSGI application\n\nThis patch adds missing initialization of OSProfiler\nwhen Cinder API is running as WSGI application.\n\nChange-Id: Ifaffa2d58eeadf5d47fafbdde5538d26bcd346a6\n"
},
{
"from": "human",
"value": "# Licensed under the Apac... | python | chosen |
[
{
"from": "system",
"value": "Handle import error on older python versions\n"
},
{
"from": "human",
"value": "import queue\nimport threading\n\n\nclass Producer(object):\n\n def __init__(self, period_in_seconds, queue, function):\n self._period_in_seconds = period_in_seconds\n s... | python | chosen |
[
{
"from": "system",
"value": "Add functionality to build the DMCColors set.\n"
},
{
"from": "human",
"value": "import csv\nimport os\nimport color\n\ndef _GetDataDirPath():\n return os.path.join(os.path.dirname(__file__), 'data')\n\ndef _GetCsvPath():\n return os.path.join(_GetDataDirPath(), '... | python | chosen |
[
{
"from": "system",
"value": "Clear the contact form after it has been successfully posted.\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\nfrom django.http import Http404\nfrom django.contrib.messages import success\nfrom django.utils.translation import ugettext_lazy as ... | python | chosen |
[
{
"from": "system",
"value": "Fix in-place os.walk() dirs modification\n"
},
{
"from": "human",
"value": "import os\nimport hashlib\n\nfrom fnmatch import fnmatchcase\n\n\ndef get_files(index):\n paths = []\n\n for dirpath, dirnames, filenames in os.walk(index.headers['root_path']):\n ... | python | chosen |
[
{
"from": "system",
"value": "Make guid required in upload API"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom .models import Upload\n\n\nclass UploadSerializer(serializers.ModelSerializer):\n class Meta:\n model = Upload\n fields = '__all__'\n"
... | python | chosen |
[
{
"from": "system",
"value": "Fix non-iobj campaign request connection"
},
{
"from": "human",
"value": "from asgiref.sync import async_to_sync\nfrom channels.layers import get_channel_layer\n\nfrom .consumers import PRESENCE_ROOM\nfrom .models import Campaign\n\n\ndef connect_info_object(sender,... | python | chosen |
[
{
"from": "system",
"value": "Change URL pattern for airport list.\n"
},
{
"from": "human",
"value": "\nfrom django.conf.urls.defaults import *\r\n\n\nurlpatterns = patterns(\"core.views\",\n url(\"^airport_list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/\", \n \"airports_fo... | python | chosen |
[
{
"from": "system",
"value": "Allow to provide a custom `occurred_at` value when building a user event\n"
},
{
"from": "human",
"value": "\"\"\"\nbyceps.services.user.event_service\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2018 Jochen Kupperschmidt\n:License: Modified BSD, see LICE... | python | chosen |
[
{
"from": "system",
"value": "Add a passing test for equality.\n\nNarrow down problems with constructing a date far in the future.\n"
},
{
"from": "human",
"value": "import unittest \n\nfrom datetime import date as vanilla_date, timedelta\n\nfrom calexicon.dates import DistantDate\n\nclass TestD... | python | chosen |
[
{
"from": "system",
"value": "Use __all__ to avoid linter errors\n"
},
{
"from": "human",
"value": "\"\"\"Site container for an HTTP server.\n\nA Web Site Process Bus object is used to connect applications, servers,\nand frameworks with site-wide services such as daemonization, process\nreload, ... | python | chosen |
[
{
"from": "system",
"value": "Fix super() call (properly) for py2.7\n"
},
{
"from": "human",
"value": "import io\nimport pcpp\n\n\nclass FortranPreprocessor(pcpp.Preprocessor):\n def __init__(self):\n super(pcpp.Preprocessor, self).__init__()\n\n def parse_to_string_lines(self, text... | python | chosen |
[
{
"from": "system",
"value": "Implement pause property more accurately\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nimport logging\nimport psutil\nfrom subprocess import PIPE\n\nclass FfmpegProcess(object):\n def __init__(self):\n self._cmdline = None\n self._process = ... | python | chosen |
[
{
"from": "system",
"value": "Reduce amounts of runs for fast test analysis\n"
},
{
"from": "human",
"value": "import unittest\n\ntry:\n import spotpy\nexcept ImportError:\n import sys\n sys.path.append(\".\")\n import spotpy\n\n\nfrom spotpy.examples.spot_setup_hymod_python import s... | python | chosen |
[
{
"from": "system",
"value": "Add `Description` to top-level imports\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\"\"\"a Python frontend to ontologies\n\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import unicode_literals\n\n__version__ = 'dev'\n__author__ = 'Martin Lar... | python | chosen |
[
{
"from": "system",
"value": "Fix tests with last changes on api.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.db import models\nfrom django_orm.postgresql.fields.arrays import ArrayField\nfrom django_orm.postgresql.fields.interval import IntervalField\nfrom django_o... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Increase rest client pool size to 100\"\n"
},
{
"from": "human",
"value": "from .base_settings import *\nimport os\n\nINSTALLED_APPS += [\n 'data_aggregator.apps.DataAggregatorConfig',\n 'webpack_loader',\n]\n\nif os.getenv('ENV') == 'localdev':\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove the dependency to django-unittest-depth\n"
},
{
"from": "human",
"value": "\"\"\"Django page CMS test suite module\"\"\"\nfrom djangox.test.depth import alltests\n\ndef suite():\n return alltests(__file__, __name__)\n"
},
{
"from": "gpt",
"valu... | python | chosen |
[
{
"from": "system",
"value": "examples/web/wiki: Change the output of <<macros>>\n"
},
{
"from": "human",
"value": "\"\"\"Utils macros\n\nUtility macros\n\"\"\"\n\ndef macros(macro, environ, *args, **kwargs):\n \"\"\"Return a list of available macros\"\"\"\n\n s = \"\\n\".join([\"* %s\" % ... | python | chosen |
[
{
"from": "system",
"value": "hack: Print date in fr_CA locale\n"
},
{
"from": "human",
"value": "# -*- encoding:utf-8 -*-\n# Template tag\nfrom django.template.defaultfilters import stringfilter\nfrom datetime import datetime, timedelta\nfrom django import template\n\nregister = template.Librar... | python | chosen |
[
{
"from": "system",
"value": "Initialize from argument or using a uniform distribution\n"
},
{
"from": "human",
"value": "import numpy\nimport theano\nimport theano.tensor as T\n\nclass Linear():\n\n\tdef __init__(self, rng, input, n_in, n_out, W=None, b=None):\n\n\t\tself.input = input\n\n\t\ti... | python | chosen |
[
{
"from": "system",
"value": "Return proper results for 'test=True'\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nManage RDP Service on Windows servers\n'''\n\n\ndef __virtual__():\n '''\n Load only if network_win is loaded\n '''\n return 'rdp' if 'rdp.enable' in _... | python | chosen |
[
{
"from": "system",
"value": "Fix test_show test to support tuned systems\n"
},
{
"from": "human",
"value": "import os.path\nimport sys\n\nfrom perf.tests import get_output\nfrom perf.tests import unittest\n\n\nclass SystemTests(unittest.TestCase):\n def test_show(self):\n args = [sys.... | python | chosen |
[
{
"from": "system",
"value": "Update `Tag` exporter code documentation.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\nfrom __future__ import absolute_import, unicode_literals\nfrom .text_exporter import TextExporter\nfrom .util import get_tags_count\n\n\nclass Ta... | python | chosen |
[
{
"from": "system",
"value": "Fix parallel example for Python 3\n"
},
{
"from": "human",
"value": "import rx\nimport concurrent.futures\nimport time\n\nseconds = [5, 1, 2, 4, 3]\n\n\ndef sleep(t):\n time.sleep(t)\n return t\n\n\ndef output(result):\n print '%d seconds' % result\n\nwith ... | python | chosen |
[
{
"from": "system",
"value": "Fix slot name in HardwareDevice\n\n"
},
{
"from": "human",
"value": "\"\"\"\nModule with the HardwareDevice model.\n\"\"\"\n\nfrom launch_control.utils.json import PlainOldData\n\n\nclass HardwareDevice(PlainOldData):\n \"\"\"\n Model representing any Hardware... | python | chosen |
[
{
"from": "system",
"value": "Remove unused field from game form\n"
},
{
"from": "human",
"value": "from crispy_forms.bootstrap import FormActions\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset\nfrom django.forms import ModelFo... | python | chosen |
[
{
"from": "system",
"value": "Decrease timeout to make test less flaky\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom tests.lib import PipTestEnvironment\n\n\n@pytest.mark.network\ndef test_timeout(script: PipTestEnvironment) -> None:\n result = script.pip(\n \"--timeout\",\n... | python | chosen |
[
{
"from": "system",
"value": "Add sum up part using pd.crosstab\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport sys\nsys.path.append('./../../')\n\nfrom pyogi.ki2converter import *\nfrom pyogi.kifu import *\n\n\nif __name__ == '__main__':\n ... | python | chosen |
[
{
"from": "system",
"value": "Add multi team output in markers\n\nSigned-off-by: Dominik Pataky <46f1a0bd5592a2f9244ca321b129902a06b53e03@netdecorator.org>\n"
},
{
"from": "human",
"value": "import json\nfrom flask import Blueprint, render_template\n\nimport database as db\nfrom database.model i... | python | chosen |
[
{
"from": "system",
"value": "Add view metrics permission to metrics view\n"
},
{
"from": "human",
"value": "from django.views.generic import TemplateView\n\nfrom admin.base.settings import KEEN_CREDENTIALS\n\n\nfrom admin.base.utils import OSFAdmin\n\n\nclass MetricsView(OSFAdmin, TemplateView)... | python | chosen |
[
{
"from": "system",
"value": "Add advanced search by select type or status\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding: utf-8\n\"\"\"\n\"\"\"\nfrom bottle import route, run, template, request\nimport urllib2\nimport urllib\n\n\nimport sys\nimport os\nfrom whoosh.index im... | python | chosen |
[
{
"from": "system",
"value": "Fix a test class name\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function\n\nimport responses\nimport simplesqlite\nfrom click.testing import... | python | chosen |
[
{
"from": "system",
"value": "docs: Use the current year in the copyright\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport sys\nimport os\n\nsys.path.insert(0, os.path.dirname(os.path.abspath('.')))\nimport youtu... | python | chosen |
[
{
"from": "system",
"value": "Add linecache module to skipped modules for pytest plugin\n\n- see #381\n- fixes the problem under Python 3, but not under Python 2\n"
},
{
"from": "human",
"value": "\"\"\"A pytest plugin for using pyfakefs as a fixture\n\nWhen pyfakefs is installed, the \"fs\" fix... | python | chosen |
[
{
"from": "system",
"value": "Add units to Core import.\n\n\nFormer-commit-id: 0f1c678c7da36ebc85827601645f6729a11e5f41 [formerly 80676409b706f3927b463afef6aa844d00aeb107]\nFormer-commit-id: f99f3956f55a26845ce5ce583545a0413e4f36ce"
},
{
"from": "human",
"value": "\"\"\"\nThis package contains c... | python | chosen |
[
{
"from": "system",
"value": "ENH: Change the API and add a test and documentation\n"
},
{
"from": "human",
"value": "\"\"\"Infiltration module.\n\n\"\"\"\nimport numpy as np\nfrom scipy.optimize import fsolve\n\ndef green_ampt_cum_infiltration(F, psi, dtheta, K, t):\n \"\"\"The Green-Ampt cu... | python | chosen |
[
{
"from": "system",
"value": "Make sure checkout is first on sys.path\n\ngit-svn-id: fe2f45b2405132b4a9af5caedfc153c2e6f542f4@894 95a46c32-92d2-0310-94a5-8d71aeb3d4b3\n"
},
{
"from": "human",
"value": "import sys, os\n\nif sys.version_info >= (2, 4):\n import doctest\nelse:\n raise ImportE... | python | chosen |
[
{
"from": "system",
"value": "Make sure example repo exists\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\ntemplates_path = ['_templates']\nsource_suffix = '.rst'\nmaster_doc = 'index'\nproject = u'dotnetexample'\ncopyright = u'2015, rtfd'\nauthor = u'rtfd'\nversion = '0.1'\nrelea... | python | chosen |
[
{
"from": "system",
"value": "Simplify SimpleAlarmSerializer to improve the performance of the graph_data endpoint\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom measurement.models import Measurement\nfrom threshold_value.models import ThresholdValue\nfrom calend... | python | chosen |
[
{
"from": "system",
"value": "Add some koji API code for testing getting build results/output.\n"
},
{
"from": "human",
"value": "#!/bin/env python\n# -*- coding: utf8 -*-\n\nimport koji\n\n\ndef upload(builds):\n \"\"\" Takes a list of one or more Koji build IDs (passed to it from\n consu... | python | chosen |
[
{
"from": "system",
"value": "Fix some minor formatting issues\n"
},
{
"from": "human",
"value": "import smbus\nimport time\n\nADDRESS = 4\nCMD_READ_ANALOG = 1\nVOLT12 = 650\nVOLT18 = 978\n\ndef map_range(x, in_min, in_max, out_min, out_max):\n out_delta = out_max - out_min\n in_delta = in... | python | chosen |
[
{
"from": "system",
"value": "Add string to display the name of the field Dimension during the import\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# Copyright (C) 2013 XCG Consulting (www.xcg-con... | python | chosen |
[
{
"from": "system",
"value": "Fix window test border _again_ (more fixed).\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\r\n# $Id:$\r\n\r\nfrom pyglet.gl import *\r\n\r\ndef draw_client_border(window):\r\n glClearColor(0, 0, 0, 1)\r\n glClear(GL_COLOR_BUFFER_BIT)\r\n\r\n glMatrix... | python | chosen |
[
{
"from": "system",
"value": "Add text selection inside 'li' element\n"
},
{
"from": "human",
"value": "from scrapy.contrib.spiders import CrawlSpider, Rule\nfrom scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor\nfrom scrapy.selector import Selector\nfrom dataset import DatasetItem\n\... | python | chosen |
[
{
"from": "system",
"value": "Use Django's memoize over a custom one.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@playfire.com>\n"
},
{
"from": "human",
"value": "from . import app_settings\n\n_render_method = None\ndef get_render_method():\n global _render_method\n... | python | chosen |
[
{
"from": "system",
"value": "Read the intput file specified on the command line.\n"
},
{
"from": "human",
"value": "import argparse\nimport sys\nimport hybridJaccard as hj\n\ndef main():\n \"Command line testinterface.\"\n\n parser = argparse.ArgumentParser()\n parser.add_argument('-c'... | python | chosen |
[
{
"from": "system",
"value": "Use select related for link_type\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.utils.encoding import force_unicode\n\nclass LinksManager(models.Manager):\n\n def for_model(... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.