conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Add homemade fast width/height reader for JPEG files\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom datetime import datetime\n\nTAG_WIDTH = 'EXIF ExifImageWidth'\nTAG_HEIGHT = 'EXIF ExifImageLength'\nTAG_DATETIME = 'Image DateTime'\n\ndef parse_t... | python | chosen |
[
{
"from": "system",
"value": "Fix a regression in accessing the username for the session.\n\nMy previous optimization to fetching the user resource along with the\nsession broke the `get_username()` function, which attempted to follow a\nnow non-existent link. It's been updated to get the expanded user\nres... | python | chosen |
[
{
"from": "human",
"value": "Complete migrate from django to toilets script\n"
},
{
"from": "gpt",
"value": "import argparse\n\nfrom ona import OnaApiClient\n\n\ndef generate_location(lat, lon):\n return ' '.join([str(lat), str(lon)])\n\nCONVERSIONS = {\n 'code': 'toilet_code', 'section': ... | python | chosen |
[
{
"from": "system",
"value": "Use sorted on the set to parametrize tests so that pytest-xdist works\n"
},
{
"from": "human",
"value": "import numpy\nimport cupy\nimport scipy.special\nimport cupyx.scipy.special\n\nfrom cupy import testing\nimport pytest\n\nscipy_ufuncs = {\n f\n for f in s... | python | chosen |
[
{
"from": "system",
"value": "Add a convenience method to get a point along a ray\n"
},
{
"from": "human",
"value": "from UM.Math.Vector import Vector\n\nclass Ray:\n def __init__(self, origin = Vector(), direction = Vector()):\n self._origin = origin\n self._direction = directi... | python | chosen |
[
{
"from": "system",
"value": "Implement propensity score fitting for logit model\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Mon May 18 15:09:03 2015\n\n@author: Alexander\n\"\"\"\nclass Match(object):\n '''\n Perform matching algorithm on input data and ... | python | chosen |
[
{
"from": "system",
"value": "emoji: Fix strings in migration 0076.\n\nIt's arguably a bug that Django puts the value strings into the\nmigration object, but this was causing test failures.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Generated by Django 1.10.5 on 2017-04-23 19:... | python | chosen |
[
{
"from": "system",
"value": "Update virtool.caches docstrings and typing\n\n"
},
{
"from": "human",
"value": "import os\nfrom typing import Union\n\nimport virtool.samples.utils\n\n\ndef join_cache_path(settings: dict, cache_id: str):\n \"\"\"\n Create a cache path string given the applic... | python | chosen |
[
{
"from": "system",
"value": "Add timestamp and newline to log messages\n"
},
{
"from": "human",
"value": "\nimport os\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\nfrom pontoon.administration.views import _update_from_repository\nfrom pont... | python | chosen |
[
{
"from": "system",
"value": "Add a route to admin/news/post to post a news story. Uses the PostForm for forms\n"
},
{
"from": "human",
"value": "from flask import render_template, redirect, url_for, flash, request\nfrom flask.ext.login import login_required, current_user\n\nfrom . import admin\... | python | chosen |
[
{
"from": "system",
"value": "Remove trailing slash from base_url\n"
},
{
"from": "human",
"value": "import os\nimport tornado.web\nfrom tornado.options import define\n\nfrom .handlers import LandingHandler, RequestHandler\n\n\nclass InteractApp(tornado.web.Application):\n \"\"\"\n Entry p... | python | chosen |
[
{
"from": "system",
"value": "Change Constants type for doubling_time and relative_contact_rate from int to float\n"
},
{
"from": "human",
"value": "\"\"\"Defaults.\"\"\"\n\nfrom .utils import RateLos\n\n\nclass Regions:\n \"\"\"Arbitrary number of counties.\"\"\"\n\n def __init__(self, **... | python | chosen |
[
{
"from": "system",
"value": "Update script to use new way of calling class.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf8 -*-\n\nimport sys, os\nimport argparse\nfrom deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo\n\ndef main(argv=None):\n\n parser = arg... | python | chosen |
[
{
"from": "system",
"value": "Change wording to use response\n"
},
{
"from": "human",
"value": "import requests, json\n\nfrom resources.urls import FACEBOOK_MESSAGES_POST_URL\n\n\nclass HttpClient():\n \"\"\"\n Client which excutes the call to\n facebook's messenger api\n \"\"\"\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Add some simple optimizations into the mesh reader classes.\n\nThis yields a ~1.5% performance improvement.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport uuid\n\nfrom abc import ABCMeta, abstractmethod\n\n\nclass BaseReader(object):\n __met... | python | chosen |
[
{
"from": "system",
"value": "Revert \"adding delete hook so the attached User object is deleted properly when and OAuth object is deleted.\"\n\nThis reverts commit 4c77c36f447d104f492e320ca684e9a737f2b803.\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User,Group\nfro... | python | chosen |
[
{
"from": "system",
"value": "Remove a line in order to be pep8 compliant after merge\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n#\n# OpenUpgrade module for Odoo\n# @copyright 2014-Today: Odoo ... | python | chosen |
[
{
"from": "system",
"value": "Update requests test for the new funcargs\n"
},
{
"from": "human",
"value": "from tests.lib import run_pip, reset_env\n\n\ndef test_timeout():\n reset_env()\n result = run_pip(\"--timeout\", \"0.01\", \"install\", \"-vvv\", \"INITools\",\n expect_error=... | python | chosen |
[
{
"from": "system",
"value": "Add signal hook for Account creation on completed registration\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\nfrom django.conf import settings\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\n\nclass UserAccount(models... | python | chosen |
[
{
"from": "system",
"value": "Fix up recurrent phase test ! Add an output plot to show what the network does with a particular input.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport logging\nimport numpy as np\nimport lmj.cli\nimport lmj.nn\n\nlmj.cli.enable_default_logging()\... | python | chosen |
[
{
"from": "system",
"value": "Create processed versions of files for manifests\n\nThis means if we have resources which are processed by django templates\nthen the processing will be done first and thus will yield for example a\nvalid javascript file\n"
},
{
"from": "human",
"value": "import os\... | python | chosen |
[
{
"from": "system",
"value": "Fix file open dialog for PySide\n"
},
{
"from": "human",
"value": "import os\n\nfrom ..qt import QtGui\n\n\ndef open_file_dialog(default_format='png'):\n \"\"\"Return user-selected file path.\"\"\"\n filename = str(QtGui.QFileDialog.getOpenFileName())\n if ... | python | chosen |
[
{
"from": "system",
"value": "Allow PUT request to /similarities/:id\n"
},
{
"from": "human",
"value": "from django.shortcuts import get_object_or_404\nfrom rest_framework import permissions, viewsets\n\nfrom similarities.utils import get_similar\nfrom .models import Artist\nfrom similarities.mo... | python | chosen |
[
{
"from": "system",
"value": "Fix more db connection strings\n"
},
{
"from": "human",
"value": "from __future__ import with_statement\nfrom alembic import context\nimport sqlalchemy\nimport logging\n\nlogging.basicConfig(level=logging.INFO, format=\"[%(asctime)s] %(levelname)s:%(name)s:%(message... | python | chosen |
[
{
"from": "system",
"value": "Update copyright date to 2015."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Project metadata\n\nInformation describing the project.\n\"\"\"\n\n# The package name, which is also the \"UNIX name\" for the project.\npackage = 'my_module'\nproject = \... | python | chosen |
[
{
"from": "system",
"value": "Increase abstractness for one test method\n"
},
{
"from": "human",
"value": "from django.template import Library\n\nregister = Library()\n\n@register.filter\ndef get_representation_for_user(role, user_role):\n if user_role.type == \"juror\":\n if role.type... | python | chosen |
[
{
"from": "system",
"value": "Add GUI for 3D Rotation script\n"
},
{
"from": "human",
"value": "from Autodesk.Revit.DB import *\nfrom Autodesk.Revit.DB.Architecture import *\nfrom Autodesk.Revit.DB.Analysis import *\nfrom System.Collections.Generic import *\n\nuidoc = __revit__.ActiveUIDocument... | python | chosen |
[
{
"from": "system",
"value": "Improve help text of registry server opts\n\nPartial-Bug: #1570946\n\nChange-Id: Iad255d3ab5d96b91f897731f4f29cd804d6b1840\n"
},
{
"from": "human",
"value": "# Copyright 2010-2011 OpenStack Foundation\n# All Rights Reserved.\n#\n# Licensed under the Apache Licens... | python | chosen |
[
{
"from": "system",
"value": "Implement extra endpoints for Javascript apps.\n"
},
{
"from": "human",
"value": "from go.vumitools.conversation.definition import (\n ConversationDefinitionBase, ConversationAction)\n\n\nclass ViewLogsAction(ConversationAction):\n action_name = 'view_logs'\n ... | python | chosen |
[
{
"from": "system",
"value": "Add raw_request method for FakeDiamondashApiClient to correspond to the recently added DiamondashApiClient.raw_request()\n"
},
{
"from": "human",
"value": "import json\n\nfrom go.dashboard import DiamondashApiError, DiamondashApiClient\n\n\nclass FakeDiamondashApiCl... | python | chosen |
[
{
"from": "system",
"value": "Add an extension parameter to the save function.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python2\n\n'''Read and write image files as NumPy arrays'''\n\n\nfrom numpy import asarray, float32\nfrom PIL import Image\n\nfrom . import np\nfrom . import utils\n\n... | python | chosen |
[
{
"from": "system",
"value": "Fix error causing single-host HA environments to report not HA.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2014 Ansible, Inc.\n# All Rights Reserved.\n\nfrom django.conf import settings\n\nfrom awx.main.models import Instance\n\n\ndef is_ha_environment():\n ... | python | chosen |
[
{
"from": "system",
"value": "Use jingo.monkey if it exists\n\nThis changes funfactory to use jingo.monkey which monkey patches Django\nform fields so you don't have to do |safe all the time.\n\nIf the available jingo isn't recent enough, then it defaults to using\nnuggets safe_django_forms which don't appe... | python | chosen |
[
{
"from": "system",
"value": "Use command to list vaults\n"
},
{
"from": "human",
"value": "import logging \nimport sys\n\nfrom glaciercmd.gcconfig import GCConfig\n\ndef run():\n logging.basicConfig(format=\"%(asctime)s %(levelname)s %(module)s: %(message)s\", level=logging.DEBUG)\n\n config ... | python | chosen |
[
{
"from": "system",
"value": "Add more assertions about types in environment\n\nTrying to figure out why things are still failing on windows/py27\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# ----------------------------------------------------------------------------\n# Copyrigh... | python | chosen |
[
{
"from": "system",
"value": "Create the psycholinguistic_db according to our needs\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# Creates a CSV of psycholinguistic dictionary\n# downloaded from web\n\n# Headers\n__author__ = 'Somsubhra Bairi'\n__email__ = 'somsubhra.bairi@gmail.c... | python | chosen |
[
{
"from": "system",
"value": "Return book index page if book not found by slug\n"
},
{
"from": "human",
"value": "from django.shortcuts import redirect\nfrom django.views.decorators.csrf import csrf_exempt\nfrom .models import BookIndex, Book\n\n\n@csrf_exempt\ndef book_index(request):\n page... | python | chosen |
[
{
"from": "system",
"value": "Rename f to func in one last place (ActionQueue)\n"
},
{
"from": "human",
"value": "import logging\nimport queue\nimport threading\n\nlog = logging.getLogger(__name__)\n\n\nclass Action:\n func = None\n args = []\n kwargs = {}\n\n def __init__(self, func... | python | chosen |
[
{
"from": "system",
"value": "ZON-2838: Fix xml path to topcpagelink\n"
},
{
"from": "human",
"value": "import zope.interface\n\nimport zeit.cms.content.reference\n\nimport zeit.campus.interfaces\n\n\nclass TopicpageLink(zeit.cms.related.related.RelatedBase):\n\n zope.interface.implements(zei... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for testing flask endpoint\n\nTest GET on the `/` endpoint\n"
},
{
"from": "human",
"value": "import unittest\nfrom stampman.services import pool\n\n\nclass TestAPIEndpoint(unittest.TestCase):\n pass\n"
},
{
"from": "gpt",
"value": "impo... | python | chosen |
[
{
"from": "system",
"value": "Disable test that is non-deterministically failing.\n"
},
{
"from": "human",
"value": "# Licensed under a 3-clause BSD style license - see LICENSE.rst\nfrom __future__ import (absolute_import, division, print_function,\n unicode_literals)\n\n#... | python | chosen |
[
{
"from": "system",
"value": "Fix issue with Query.parse_chain being broken in InsertRelationCommand\n"
},
{
"from": "human",
"value": "class Query:\n def __init__(self, ident, name, oper, value):\n self.ident = ident\n self.name = name\n self.oper = oper\n self.va... | python | chosen |
[
{
"from": "system",
"value": "Use more precise grep expression\n\nOtherwise we match wrong lines when memory stats contain PID.\n\nChange-Id: I924c1b151ddaad8209445a514bf02a7af5d2e0e0\nReviewed-on: http://review.couchbase.org/79848\nReviewed-by: Pavel Paulau <dd88eded64e90046a680e3a6c0828ceb8fe8a0e7@gmail.c... | python | chosen |
[
{
"from": "system",
"value": "Use check response for import update tests\n"
},
{
"from": "human",
"value": "# Copyright (C) 2016 Google Inc.\n# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>\n\nfrom integration.ggrc.converters import TestCase\n\nfrom ggrc import mod... | python | chosen |
[
{
"from": "system",
"value": "Remove logger as not used in module\n"
},
{
"from": "human",
"value": "import logging\nimport bb_dbconnector_pg\n\nlog = logging.getLogger('bb_log.' + __name__)\n\n\nclass DBConnectorInterfaceFactory:\n\n def __init__(self):\n pass\n\n @staticmethod\n ... | python | chosen |
[
{
"from": "system",
"value": "Optimize number of updates for queryset and instance listeners\n\nOnly push additions to queryset listeners, not instance changes.\nOnly push changes to instance listeners, not queryset additions.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom djan... | python | chosen |
[
{
"from": "system",
"value": "Save scraper settings to database\n\nThis is the first step in allowing multiple processes to run on\ndifferent servers. Coming in the next commit!\n"
},
{
"from": "human",
"value": "import datetime\nimport pymongo\nimport os\nimport sys\nimport time\nfrom courtread... | python | chosen |
[
{
"from": "system",
"value": "Fix args when Task.data is empty\n"
},
{
"from": "human",
"value": "from changes.api.serializer import Serializer, register\nfrom changes.models import Task\n\n\n@register(Task)\nclass TaskSerializer(Serializer):\n def serialize(self, instance, attrs):\n r... | python | chosen |
[
{
"from": "system",
"value": "Update Pango to use CoreText"
},
{
"from": "human",
"value": "class PangoPackage (GnomePackage):\n\tdef __init__ (self):\n\t\tGnomePackage.__init__ (self,\n\t\t\t'pango',\n\t\t\tversion_major = '1.28',\n\t\t\tversion_minor = '4',\n\t\t\tconfigure_flags = [\n\t\t\t\t... | python | chosen |
[
{
"from": "system",
"value": "Use pysolr instead of haystack in indexing job\n"
},
{
"from": "human",
"value": "import itertools\nimport logging\n\nfrom django.conf import settings\nfrom django.core.management.base import BaseCommand, CommandError\n\nfrom haystack import site\nimport pysolr\n\nl... | python | chosen |
[
{
"from": "system",
"value": "devilry_qualfiesforexam: Remove period id from app url.\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url, include\nfrom django.contrib.auth.decorators import login_required\nfrom django.views.i18n import javascript_catalog\nfrom django.v... | python | chosen |
[
{
"from": "system",
"value": "Use \"The StackStorm Authors\" in copyright\n\nCo-authored-by: Eugen C. <67cac084fbaf94f499d5252e3cb50165dbf6e026@armab.io>"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# Copyright 2020 The StackStorm Developers\n#\n# Licensed under the Apache License, ... | python | chosen |
[
{
"from": "system",
"value": "[Discord] Remove Audio Not Playing error\n\n"
},
{
"from": "human",
"value": "\nfrom discord.ext.commands.errors import CommandError\n\nclass NotServerOwner(CommandError):\n\t'''Not Server Owner'''\n\tpass\n\nclass VoiceNotConnected(CommandError):\n\t'''Voice Not Co... | python | chosen |
[
{
"from": "system",
"value": "Add body_href method for getting a public url for a Style's body.\n"
},
{
"from": "human",
"value": "from geoserver.support import ResourceInfo, atom_link\n\nclass Style(ResourceInfo):\n def __init__(self,catalog, node):\n self.catalog = catalog\n self.name =... | python | chosen |
[
{
"from": "system",
"value": "telemetry: Fix screen recording with multiple connected devices\n\nMake it possible to use the Android screen recording profiler with\nmultiple connected devices. Only the screen on the device that is\nactually running the telemetry test will get recorded.\n\nBUG=331435\nTEST=t... | python | chosen |
[
{
"from": "system",
"value": "Remove ANSI escape sequences from panel output\n"
},
{
"from": "human",
"value": "import sublime\n\n\ndef universal_newlines(string):\n return string.replace('\\r\\n', '\\n').replace('\\r', '\\n')\n\n\ndef panel(message, run_async=True):\n message = universal_... | python | chosen |
[
{
"from": "system",
"value": "Support loading pickled data referencing SortedDict.\n\nDjango used to provide a class called `SortedDict`, which has long been\ndeprecated in favor of Python's own `OrderedDict`. However, due to the\nway that pickling works, older signatures would still attempt to loading\na `... | python | chosen |
[
{
"from": "system",
"value": "Make ultimate question ever more ultimate\n"
},
{
"from": "human",
"value": "from pywps import Process, LiteralOutput\nfrom pywps.app.Common import Metadata\n\n\nclass UltimateQuestion(Process):\n def __init__(self):\n inputs = []\n outputs = [Liter... | python | chosen |
[
{
"from": "system",
"value": "Fix trailing slash 404 for flat pages and co\n\nBy modifying the URL, flatpage requests without a trailing slash will\nalways fail, triggering the redirect provided by `APPEND_SLASH`.\n\nThis is important because urls that share a common endpoint path were\n404ing on a flatpage... | python | chosen |
[
{
"from": "system",
"value": "Use dataframe to show how semantic information is used\n"
},
{
"from": "human",
"value": "\"\"\"\nPlotting a diagonal correlation matrix\n======================================\n\n_thumb: .3, .6\n\"\"\"\nimport numpy as np\nimport seaborn as sns\nimport matplotlib.p... | python | chosen |
[
{
"from": "system",
"value": "Add summary to foirequest search"
},
{
"from": "human",
"value": "from haystack import indexes\nfrom haystack import site\n\nfrom foirequest.models import FoiRequest\n\n\nclass FoiRequestIndex(indexes.SearchIndex):\n text = indexes.EdgeNgramField(document=True, u... | python | chosen |
[
{
"from": "system",
"value": "Add test for warn spelling of build_json_response\n"
},
{
"from": "human",
"value": "\"\"\"\nUnittests for opal.core.views\n\"\"\"\nfrom opal.core import test\n\nfrom opal.core import views\n\nclass SerializerTestCase(test.OpalTestCase):\n\n def test_serializer_d... | python | chosen |
[
{
"from": "system",
"value": "Update status using API instead of direct db access\n"
},
{
"from": "human",
"value": "import logging\nimport django.dispatch\nfrom django.dispatch import receiver\n\nlogger = logging.getLogger(__name__)\n\n__all__ = ['task_status_changed', 'celery_request_status_up... | python | chosen |
[
{
"from": "system",
"value": "Add another blank line (thanks flake) --autopull"
},
{
"from": "human",
"value": "import os\nfrom collections import namedtuple\n\nResponse = namedtuple('Response', 'command_status message')\n\n\n# Allows use of `environ_or_none(\"foo\") or \"default\"` shorthand\n#... | python | chosen |
[
{
"from": "system",
"value": "Replace slug field with get_slug function\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.utils.translation import pgettext as _\nfrom django_prices.models import PriceField\nfrom satchless.util.models import Subtyped\nfrom satchless.ite... | python | chosen |
[
{
"from": "system",
"value": "Use safe-load when loading configuration to avoid deprecation warning\n"
},
{
"from": "human",
"value": "import yaml\nfrom jaraco.collections import ItemsAsAttributes\n\n\nclass ConfigDict(ItemsAsAttributes, dict):\n\t@classmethod\n\tdef from_yaml(cls, filename):\n\... | python | chosen |
[
{
"from": "system",
"value": "Change to Controller from Delegate shell\n\n"
},
{
"from": "human",
"value": "\"\"\"NM-Controller accounts are used to provide secure access to the XMLRPC API. They are normal Unix accounts with a shell that tunnels XMLRPC requests to the API server.\"\"\"\n\nimpor... | python | chosen |
[
{
"from": "system",
"value": "Print a little summary when you're done\n"
},
{
"from": "human",
"value": "from store import create_directories\nimport options\nimport task\n\ndef parse_jugfile():\n import jugfile\n\ndef print_tasks():\n for i,t in enumerate(task.alltasks):\n print 'T... | python | chosen |
[
{
"from": "system",
"value": "Fix fellowship_grant when upload data\n"
},
{
"from": "human",
"value": "import pandas as pd\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.core.exceptions import ObjectDoesNotExist\n\nfrom fellowms.models import Fellow\n\nclass Co... | python | chosen |
[
{
"from": "system",
"value": "Handle SystemExit errors and add exit_code\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport pytest\n\nfrom cookiecutter.main import cookiecutter\n\n\nclass Cookies(object):\n \"\"\"Class to provide convenient access to the cookiecutter API.\"\... | python | chosen |
[
{
"from": "system",
"value": "Fix error on connection failures\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nCopyright 2010 Asidev s.r.l.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in complia... | python | chosen |
[
{
"from": "system",
"value": "Update mongo import of files to drop existing collection first\n"
},
{
"from": "human",
"value": "import subprocess\n\nfrom edx_data_research.parsing.parse import Parse\n\nclass SQL(Parse):\n\n def __init__(self, args):\n super(SQL, self).__init__(args)\n ... | python | chosen |
[
{
"from": "system",
"value": "Update metadata with dynamic config types\n\nAfter settings rework, we decided to make the upgrade plug-ins define their own configuration types. This is basically the definition for these configuration types. Only the get_version function is not yet implemented.\n\nContributes... | python | chosen |
[
{
"from": "system",
"value": "Fix directory watching when serving the docs.\n"
},
{
"from": "human",
"value": "import invoke\nimport livereload\nimport shutil\n\nserver = livereload.Server()\n\n\n@invoke.task\ndef clean():\n shutil.rmtree('./build')\n\n\n@invoke.task(pre=[clean])\ndef build()... | python | chosen |
[
{
"from": "system",
"value": "Fix IP keyfunc for reverse proxies\n"
},
{
"from": "human",
"value": "\"\"\"\n\n\"\"\"\n\n\ndef get_remote_address(request):\n \"\"\"\n :param: request: request object of sanic\n :return: the ip address of given request (or 127.0.0.1 if none found)\n \"\... | python | chosen |
[
{
"from": "system",
"value": "Fix legacy return in redirectAndSave\n"
},
{
"from": "human",
"value": "import flask\nfrom .. import auth\nimport urllib.parse\n\ndef checkForSession():\n\tif \"uid\" in flask.session:\n\t\tsession = auth.validateSession(flask.session[\"uid\"])\n\t\tif session != No... | python | chosen |
[
{
"from": "system",
"value": "Change rel paths into abspaths and use helper module\n"
},
{
"from": "human",
"value": "#!/bin/env python\n#\n# glidein_top\n#\n# Execute a top command in the same glidein as the user job\n#\n# Usage:\n# glidein_top.py <cluster>.<process> [-name <schedd_name>] [-po... | python | chosen |
[
{
"from": "system",
"value": "Use /projects/ not /+projects/ when caching\n\nThis prevents staticgenerator from sending out an annoying email\nevery 10 minutes.\n"
},
{
"from": "human",
"value": "# This file is part of OpenHatch.\n# Copyright (C) 2010 OpenHatch, Inc.\n#\n# This program is free s... | python | chosen |
[
{
"from": "system",
"value": "Add a small test for init with a file arg.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# coding: utf-8\n\nimport os\nimport unittest\nfrom adjutant import SC2Replay\n\nTEST_DIR = os.path.realpath(os.path.dirname(__file__)) + '/'\n\nclass TestSC2Replay(... | python | chosen |
[
{
"from": "system",
"value": "Add consistent 4 space indentation\n\nApplied 4 space indentation all along the main pson.py file.\n"
},
{
"from": "human",
"value": "import json\nfrom pprint import pprint\n\ndef pathparser(path, separator=\".\"):\n return path.split(separator)\n\ndef pathqu... | python | chosen |
[
{
"from": "system",
"value": "Move data directory in package\n"
},
{
"from": "human",
"value": "import os.path as osp\n\n\ndef get_data_dir():\n this_dir = osp.dirname(osp.abspath(__file__))\n return osp.realpath(osp.join(this_dir, '../data'))\n\n\ndef get_logs_dir():\n this_dir = osp.d... | python | chosen |
[
{
"from": "system",
"value": "Add error handling for GET request.\n"
},
{
"from": "human",
"value": "#! /usr/bin/env python3\n# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v2.0. If a copy of the MPL was not distributed with this\n# file, you can obtain one at ... | python | chosen |
[
{
"from": "system",
"value": "Check that test emails are sent to BOB\n"
},
{
"from": "human",
"value": "from mock import Mock\nimport pytest\nimport smtplib\n\nfrom donemail import donemail\n\nBOB = 'bob@example.com'\n\n\n@pytest.fixture(autouse=True)\ndef monkeypatch_send_email(monkeypatch):\n ... | python | chosen |
[
{
"from": "system",
"value": "Add updating of jobs if their state is now unknown\n"
},
{
"from": "human",
"value": "from django.contrib.auth.models import User\n\nfrom models import Job\nfrom interface import get_all_jobs\n\n\ndef run_all():\n for user in User.objects.all():\n creds = ... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug about the function, 'val'.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\n\n### Attribute Wrapper\nclass AttrWrapper(object):\n attrs = []\n\n def __setattr__(self, name, value):\n if name not in self.attrs:\n raise Attribu... | python | chosen |
[
{
"from": "system",
"value": "Use utils._iter_but_not_str_or_map in Writer log creation.\n"
},
{
"from": "human",
"value": "from .monad import Monad\nfrom .functor import fmap\n\nclass Writer(Monad):\n \"\"\"Stores a value as well as a log of events that have transpired\n with the value.\n... | python | chosen |
[
{
"from": "system",
"value": "Remove stray print debug message\n\nSigned-off-by: Steven Dake <8638f3fce5db0278cfbc239bd581dfc00c29ec9d@redhat.com>\n"
},
{
"from": "human",
"value": "class LazyPluggable(object):\n \"\"\"A pluggable backend loaded lazily based on some value.\"\"\"\n\n def __... | python | chosen |
[
{
"from": "system",
"value": "Add auto run test cases, just add STL files.\n"
},
{
"from": "human",
"value": "import sys\nimport os\nimport subprocess\n\ndef main():\n\texecutableName = 'CuraEngine'\n\tif len(sys.argv) > 1:\n\t\texecutableName = sys.argv[1]\n\t\n\texitValue = 0\n\tfor subPath in... | python | chosen |
[
{
"from": "system",
"value": "Change prompt and intro message\n"
},
{
"from": "human",
"value": "import cmd\nimport argparse\nfrom Interface import *\n\n\nclass Lexeme(cmd.Cmd):\n intro = \"Welcome to Lexeme. Input ? for help and commands\"\n prompt = \"(lexeme) \"\n\n def do_list(self,... | python | chosen |
[
{
"from": "system",
"value": "Change fields to the schema agreed\n"
},
{
"from": "human",
"value": "from eduid_am.exceptions import UserDoesNotExist\n\n\ndef attribute_fetcher(db, user_id):\n attributes = {}\n\n user = db.registered.find_one({'_id': user_id})\n if user is None:\n ... | python | chosen |
[
{
"from": "system",
"value": "Define urlpatterns as a pure list (don't call patterns)"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url\n\nfrom .views import ClipboardFileAPIView, ClipboardImageAPIView\n\nurlpatterns = patterns(\n '',\n url(r'^images/(?P<pk>\\d+)$... | python | chosen |
[
{
"from": "system",
"value": "Remove IP from allowed hosts\n"
},
{
"from": "human",
"value": "from .base import *\n\nDEBUG = False\n\nALLOWED_HOSTS = ['188.226.249.33', 'cinderella.li']\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2',\n 'NAME... | python | chosen |
[
{
"from": "system",
"value": "Update nopep8 instructions to NOQA\n\n`flake8` seems to have dropped support for `# nopep8` in the 3.x\nversions (confirmed by testing with latest and `<3`). This causes our\nstyle checking tests to fail.\n\nReplace these with `# NOQA` and pin them to the specific error we care... | python | chosen |
[
{
"from": "system",
"value": "Use Biopython's string based FASTA parser\n\nThis was introduced in Biopython 1.61 back in February 2013,\r\nso the dependencies shouldn't matter.\r\n\r\nYou could go further here and use a generator expression\r\nover a list comprehension?"
},
{
"from": "human",
"v... | python | chosen |
[
{
"from": "system",
"value": "Remove default method_name in SerializerMethodField"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom uchicagohvz.game.models import *\n\nclass KillSerializer(serializers.ModelSerializer):\n\tclass Meta:\n\t\tmodel = Kill\n\t\tfields = ('... | python | chosen |
[
{
"from": "system",
"value": "Handle transactions manually when saving downloaded logs\n"
},
{
"from": "human",
"value": "import api\nimport db\nfrom utils import parse_timestamp\n\nimport hashlib\nimport json\n\ndef download_logs():\n \"\"\" Download mailgun logs and store them in the databa... | python | chosen |
[
{
"from": "system",
"value": "Declare use of string OIDs\n"
},
{
"from": "human",
"value": "\"\"\"Stand-in module for those without the speed-enhanced tuple-OID implementation\"\"\"\n\ndef OID( value ):\n\t\"\"\"Null function to pretend to be oid.OID\"\"\"\n\treturn str(value)\n\n"
},
{
... | python | chosen |
[
{
"from": "system",
"value": "Remove CloudWave specific context expansion\n"
},
{
"from": "human",
"value": "from node import Node\nfrom model.cpu import CPU\nfrom extraction.http.cpu_cw_http import CpuCwHTTP\n\n\nclass CPUNode(Node):\n\n label = \"CPU\"\n\n def __init__(self, service, timespa... | python | chosen |
[
{
"from": "system",
"value": "Make loggers part of the top-level SeqIO API.\n\nPiperOrigin-RevId: 400711636\n"
},
{
"from": "human",
"value": "# Copyright 2021 The SeqIO Authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compli... | python | chosen |
[
{
"from": "system",
"value": "Fix stray zmq import in egg_info\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n\nimport glob\nimport os\nimport copy\n\nimport zmq\nfrom distutils.core import Extension\n\ndef get_extensions(**kwargs):\n \"\"\... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.