conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Make check against None instead of falsey things.\n"
},
{
"from": "human",
"value": "import logging\nimport lintreview.tools as tools\n\nfrom lintreview.diff import DiffCollection\nfrom lintreview.review import Problems\nfrom lintreview.review import Review\n\nlog =... | python | chosen |
[
{
"from": "system",
"value": "Convert array back to fortran before setting\n\nUnfortunately, it looks like numpy.ndarray.swapaxes converts\nthe ordering from Fortran to C. When this happens, a warning\nmessage will be printed to the console later that a conversion to\nFortran ordering is required.\n\nInstea... | python | chosen |
[
{
"from": "system",
"value": "Update ``maps`` to use the ``json_response`` function.\n"
},
{
"from": "human",
"value": "import json\n\nfrom django.core.serializers.json import DjangoJSONEncoder\nfrom django.http import HttpResponse\nfrom django.template.response import TemplateResponse\n\nfrom u... | python | chosen |
[
{
"from": "system",
"value": "Fix API call for is-superuser.\n"
},
{
"from": "human",
"value": "from braces.views import UserPassesTestMixin\n\n\nclass CustomUserTest(UserPassesTestMixin):\n \"\"\"User must be a member of this organization to view this content.\n\n This also requires that ... | python | chosen |
[
{
"from": "system",
"value": "Fix dependency to mis_builder_budget to remove runbot warning\n"
},
{
"from": "human",
"value": "# Copyright 2018 Camptocamp SA\n# Copyright 2015 Agile Business Group\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\n{\n 'name': 'Switzerlan... | python | chosen |
[
{
"from": "system",
"value": "Fix makemessages test to look for jinja2\n"
},
{
"from": "human",
"value": "from unittest.mock import patch\nfrom django.test import TestCase\n\nfrom ..commands.makemessages import Command as MakeMessagesCommand\nfrom django_jinja.management.commands.makemessages im... | python | chosen |
[
{
"from": "system",
"value": "Use a env var to get DB path\n"
},
{
"from": "human",
"value": "import os\nbasedir = os.path.abspath(os.path.dirname(__file__))\n\n# forms wtf config\nWTF_CSRF_ENABLED = True\nSECRET_KEY = 'impossible-to-guess'\n\n# sqlalchemy database config\nSQLALCHEMY_DATABASE_UR... | python | chosen |
[
{
"from": "system",
"value": "Send welcome message at very first of communication channel\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\"\"\"Example for aiohttp.web websocket server\n\"\"\"\n\nimport os\n\nfrom aiohttp import web\n\n\nWS_FILE = os.path.join(os.path.dirname(__file__... | python | chosen |
[
{
"from": "system",
"value": "Update the UA used in CloudSQLReplicator\n"
},
{
"from": "human",
"value": "# Copyright 2018 The Pontem Authors. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the L... | python | chosen |
[
{
"from": "system",
"value": "Update context for one calendar\n"
},
{
"from": "human",
"value": "from cms.plugin_base import CMSPluginBase\nfrom cms.plugin_pool import plugin_pool\nimport datetime\nfrom django.utils.translation import ugettext as _\nfrom events.models import CalendarEventsPlugin... | python | chosen |
[
{
"from": "system",
"value": "Change default year to maximal available year, not current year.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\n\"\"\"Basic folder controller.\n\nAdditional views on asset contents.\n\"\"\"\n\nimport datetime\nfrom web.extras.contentment.api import action, ... | python | chosen |
[
{
"from": "system",
"value": "Set SQLALCHEMY_TRACK_MODIFICATIONS option to False\n\nThis commit adds code responsible for setting SQLALCHEMY_TRACK_MODIFICATION\noption to False. This option is provided by Flask-SQLAlchemy extension and\nrelates to event system provided by this extension. This project uses e... | python | chosen |
[
{
"from": "system",
"value": "Remove reference to the scheduler, which was removed.\n"
},
{
"from": "human",
"value": "from django.conf.urls import include\nfrom django.contrib import admin\n\n\nadmin.autodiscover()\n\n\nurlpatterns = [\n (r'^admin/', include(admin.site.urls)),\n (r'^accou... | python | chosen |
[
{
"from": "system",
"value": "Add user serialized to ServiceSerializer\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom .models import Service, Category, ServicePhoto\n\n\nclass CategorySerializer(serializers.ModelSerializer):\n class Meta:\n model = Ca... | python | chosen |
[
{
"from": "system",
"value": "Fix CTCP import and naming bug\n"
},
{
"from": "human",
"value": "from motobot import match, Notice, Eat, __VERSION__\nfrom time import strftime, localtime\n\n\n@match(r'\\x01(.+)\\x01', priority=Priority.max)\ndef ctcp_match(bot, context, message, match):\n mapp... | python | chosen |
[
{
"from": "system",
"value": "Fix typo; bin_heap will now properly instate\n"
},
{
"from": "human",
"value": "import bin_heap as bh\n\n\nclass Priority(object):\n \"\"\"docstring for priority\"\"\"\n def __init__(self):\n self.bin_heap = bh\n\n def insert(self, item, rank):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix execjs.ProgramError: Error: Cannot find module 'nib' for -stylus\n"
},
{
"from": "human",
"value": "from docutils.core import publish_parts\nimport coffeescript\nfrom scss import Scss\nfrom stylus import Stylus\n\nfrom .util import as_unicode\n\n\n\ndef rst_to_h... | python | chosen |
[
{
"from": "system",
"value": "Allow to search items by description.\n"
},
{
"from": "human",
"value": "# -*- coding:utf-8 -*-\nfrom django.contrib import admin\nfrom sorl.thumbnail.admin import AdminImageMixin\n\nfrom .models import Section, Group, Item, Image, Area\n\n\nclass ImageInline(Admin... | python | chosen |
[
{
"from": "system",
"value": "Fix for byte literals compatibility.\n"
},
{
"from": "human",
"value": "from django import http\r\nfrom django.contrib import auth\r\nfrom django.core import exceptions\r\n\r\n\r\nclass TokenMiddleware(object):\r\n \"\"\"\r\n Middleware that authenticates agai... | python | chosen |
[
{
"from": "system",
"value": "Return error for image upload\n"
},
{
"from": "human",
"value": "from rest_framework import views, serializers\nfrom rest_framework.decorators import permission_classes\nfrom rest_framework.parsers import FileUploadParser\nfrom rest_framework.permissions import IsAu... | python | chosen |
[
{
"from": "system",
"value": "Make quota usage read only (nc-263)\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom nodeconductor.quotas import models, utils\nfrom nodeconductor.core.serializers import GenericRelatedField\n\n\nclass QuotaSerializer(serializers.Hyp... | python | chosen |
[
{
"from": "system",
"value": "Fix for specifying the static directory in later versions of flask"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\n flaskext.clevercss\n ~~~~~~~~~~~~~\n\n A small Flask extension that makes it easy to use cleverCSS with your Flask\n app... | python | chosen |
[
{
"from": "system",
"value": "Fix bad transposition of utility function in sflow\n"
},
{
"from": "human",
"value": "import struct, socket\n\n\ndef unpack_address(u):\n addrtype = u.unpack_uint()\n\n if self.addrtype == 1:\n self.address = u.unpack_fopaque(4)\n\n if self.addrtype ... | python | chosen |
[
{
"from": "system",
"value": "Add output when password is not found"
},
{
"from": "human",
"value": "import hashlib, sys, urllib.request\n\ndef main():\n\thash = hashlib.sha1(bytes(sys.argv[1], \"utf-8\"))\n\tdigest = hash.hexdigest().upper()\n\turl = f\"https://api.pwnedpasswords.com/range/{dig... | python | chosen |
[
{
"from": "system",
"value": "Add Sublime Text 3 support\n"
},
{
"from": "human",
"value": "import sublime, sublime_plugin\nimport subprocess\nimport threading\n\nDEBUG = False\n\n# Base rsync command template: rsync -arv <local> <remote>\nbase_cmd = \"rsync -arv {0} {1}\"\n\nclass SyncOnSaveCom... | python | chosen |
[
{
"from": "system",
"value": "Use self.sdtout and CommandError to print output\n"
},
{
"from": "human",
"value": "from django.contrib.auth import get_user_model\nfrom django.core.management.base import BaseCommand\nfrom rest_framework.authtoken.models import Token\n\n\nUserModel = get_user_model... | python | chosen |
[
{
"from": "system",
"value": "Create Error-classes, Client class and do function for Request\n"
},
{
"from": "human",
"value": "class Request:\n GET = 'get'\n POST = 'post'\n\n def __init__(self, url, type, data=None):\n self.url = url\n self.type = type\n self.data... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong class in 'super()' call\n\nOops\n"
},
{
"from": "human",
"value": "class CommandException(Exception):\n\t\"\"\"\n\tThis custom exception can be thrown by commands when something goes wrong during execution.\n\tThe parameter is a message sent to the source ... | python | chosen |
[
{
"from": "system",
"value": "Add punctuation to basic info\n"
},
{
"from": "human",
"value": "import string\nimport textwrap\nfrom veryprettytable import VeryPrettyTable\nfrom plugins import BasePlugin\n\n__author__ = 'peter'\n\n\nclass BasicInfoPlugin(BasePlugin):\n name = 'BasicInfoPlugin'... | python | chosen |
[
{
"from": "system",
"value": "Make hardware search only on USB on Ubuntu Linux\n"
},
{
"from": "human",
"value": "#I got this code on http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python\n#So, yeah. I didn't wrote this code :-P\nimport sys\nimport glob\nimport seri... | python | chosen |
[
{
"from": "system",
"value": "Add mp4 as input ext\n"
},
{
"from": "human",
"value": "FFMPEG_PATH = '/usr/local/bin/ffmpeg'\n\nVIDEO_CODEC = 'h264' # used with ffprobe to detect whether or not we need to encode\nVIDEO_ENCODER = 'h264_omx'\n\nAUDIO_CODEC = 'aac' # used with ffprobe to detect whet... | python | chosen |
[
{
"from": "system",
"value": "Add ability to filter job list by job state\n"
},
{
"from": "human",
"value": "\"\"\"Get info about jobs running on this cluster.\"\"\"\nimport pyslurm\n\nfrom job import Job\n\n\nclass Jobs(object):\n \"\"\"A service object to inspect jobs.\"\"\"\n\n @propert... | python | chosen |
[
{
"from": "system",
"value": "Add get_starcheck_catalog_at_date to top level items in mica.starcheck\n"
},
{
"from": "human",
"value": "from .starcheck import get_starcheck_catalog, main, get_mp_dir\n"
},
{
"from": "gpt",
"value": "from .starcheck import get_starcheck_catalog, get_st... | python | chosen |
[
{
"from": "system",
"value": "Fix another exception for ud when def isn't found\n"
},
{
"from": "human",
"value": "\"\"\"Looks up a term from urban dictionary\n@package ppbot\n\n@syntax ud <word>\n\n\"\"\"\nimport requests\nimport json\n\nfrom modules import *\n\nclass Urbandictionary(Module):\n... | python | chosen |
[
{
"from": "system",
"value": "Make it optional to only update metadata of new podcasts\n"
},
{
"from": "human",
"value": "from django.core.management import BaseCommand\nfrom podcasts.models import Podcast\n\n\nclass Command(BaseCommand):\n help = 'Initialize podcasts with data from their RSS... | python | chosen |
[
{
"from": "system",
"value": "Use correct url pattern format\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, include\n\n\nurlpatterns = patterns(\n (r'^jmbo/', include('jmbo.urls')),\n (r'^comments/', include('django.contrib.comments.urls')),\n (r'^post/', incl... | python | chosen |
[
{
"from": "system",
"value": "Save point, got code written but need to figure out the base probabilities\n"
},
{
"from": "human",
"value": "import sys\n\ncount = 0\nfor line in sys.stdin:\n if count == 0:\n B = int(line)\n elif count == 1:\n N = int(line)\n else:\n ... | python | chosen |
[
{
"from": "system",
"value": "Change the monkey patching order\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.conf.urls.defaults import *\n\nfrom .profiles import urls as profiles_urls\n\nfrom django.views.generic.simple import direct_to_template\n\nfrom django.... | python | chosen |
[
{
"from": "system",
"value": "Test with file from Jackub\n\ngit-svn-id: 0eea5547755d67006ec5687992a7464f0ad96b59@379 acbc63fc-6c75-0410-9d68-8fa99cba188a\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\"\"\"\nTests of io.axonio\n\"\"\"\n\ntry:\n import unittest2 as unittest\nexcept Imp... | python | chosen |
[
{
"from": "system",
"value": "Fix logic error under preparePageFrames\n"
},
{
"from": "human",
"value": "class Algorithm:\n\t\"\"\"\n\tAlgorithm Class\n\n\tBase class for the page substitution algorithms.\n\t\"\"\"\n\tdef __init__(self, input = []):\n\t\t\"\"\"\n\t\tAlgorithm Constructor.\n\n\t\... | python | chosen |
[
{
"from": "system",
"value": "Remove double slashes in the Redis commands urls\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\nimport lxml.etree, lxml.html\nimport re\n\nurl = \"http://redis.io\"\noutput = \"output.txt\"\n\nf = open(output, \"w\");\n\ntree = lxml... | python | chosen |
[
{
"from": "system",
"value": "Use Python2/3 compatible form of exec\n"
},
{
"from": "human",
"value": "# Copyright (c) Calico Development Team.\n# Distributed under the terms of the Modified BSD License.\n# http://calicoproject.org/\n\nfrom jupyter_kernel import Magic, option\n\nclass PythonMagi... | python | chosen |
[
{
"from": "system",
"value": "Fix bad merge and formatting\n"
},
{
"from": "human",
"value": "from django.conf.urls import url\n\nfrom .api import (\n EmwfOptionsView,\n CaseListFilterOptions,\n DeviceLogUsers,\n DeviceLogIds,\n MobileWorkersOptionsView,\n ReassignCaseOptions,\... | python | chosen |
[
{
"from": "system",
"value": "Add temp_value (optional) parameter to RRDDataSource constructor.\n"
},
{
"from": "human",
"value": "class RRDDataSource(object):\n name = \"\"\n data_source_type = \"\"\n heartbeat = \"\"\n temp_value = 0\n\n def __init__(self, name, data_source_type... | python | chosen |
[
{
"from": "system",
"value": "Check default socket and localhost:4243 for Docker daemon\n"
},
{
"from": "human",
"value": "from docker import Client\nimport logging\nimport os\nimport re\nimport yaml\n\nfrom ..project import Project\nfrom .docopt_command import DocoptCommand\nfrom .formatter imp... | python | chosen |
[
{
"from": "system",
"value": "Remove bogus test; the master is not a terminal on Solaris and HP-UX.\n"
},
{
"from": "human",
"value": "# Test to see if openpty works. (But don't worry if it isn't available.)\n\nimport os\nfrom test.test_support import verbose, TestFailed, TestSkipped\n\ntry:\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix _select_attributes from project api\n"
},
{
"from": "human",
"value": "# -*- coding: utf8 -*-\n# This file is part of PYBOSSA.\n#\n# Copyright (C) 2015 Scifabric LTD.\n#\n# PYBOSSA is free software: you can redistribute it and/or modify\n# it under the terms of ... | python | chosen |
[
{
"from": "system",
"value": "Remove unwanted print statement from example\n"
},
{
"from": "human",
"value": "from tornado import ioloop, web\nfrom jsonrpcserver import method, async_dispatch as dispatch\n\n\n@method\nasync def ping():\n return \"pong\"\n\n\nclass MainHandler(web.RequestHandl... | python | chosen |
[
{
"from": "system",
"value": "[pinboost] Write GDB debug session information to stderr, as stdout will be redirected to a log file\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport sys, os, tempfile\n\npid = int(sys.argv[1])\nmytid = int(sys.argv[2])\n\n# FIXME: optionally attac... | python | chosen |
[
{
"from": "system",
"value": "Switch default log level to WARN\n"
},
{
"from": "human",
"value": "import logging\n\n\nclass Options(object):\n service = ''\n agent_host = ''\n agent_port = 0\n log_level = logging.ERROR\n\n def __init__(self, **kwds):\n self.__dict__.update(... | python | chosen |
[
{
"from": "system",
"value": "Use subprocess to update, seems silly to use both subprocess and os.systemm in the same module. update also reports if the version hasn't changed.\n"
},
{
"from": "human",
"value": "import os\nimport os.path\nimport subprocess\n\nfrom module import Module\n\nclass g... | python | chosen |
[
{
"from": "system",
"value": "Change test name and test SVR too\n"
},
{
"from": "human",
"value": "import numpy as np\n\nfrom tslearn.metrics import cdist_gak\nfrom tslearn.svm import TimeSeriesSVC\n\n__author__ = 'Romain Tavenard romain.tavenard[at]univ-rennes2.fr'\n\n\ndef test_svm_gak():\n ... | python | chosen |
[
{
"from": "system",
"value": "Document AgentCheck count and monotonic_count methods\n"
},
{
"from": "human",
"value": "self.gauge( ... ) # Sample a gauge metric\n\nself.increment( ... ) # Increment a counter metric\n\nself.decrement( ... ) # Decrement a counter metric\n\nself.histogram( ... ) # ... | python | chosen |
[
{
"from": "system",
"value": "Modify test to reflect that api returns string response.\n"
},
{
"from": "human",
"value": "import pytest\nfrom pygraylog.pygraylog import graylogapi\n\ndef test_get():\n api = graylogapi.GraylogAPI('http://echo.jsontest.com/one/two', \n username = 'Zack',... | python | chosen |
[
{
"from": "system",
"value": "Fix no message attribute in exception\n\nFor py35, message attribute in exception seems removed.\nWe should directly get the string message from exception object\nif message attribute not presented. And since get message attribute\nalready been deprecated. We should remove sopp... | python | chosen |
[
{
"from": "system",
"value": "Add opt in/out keywords for tropo\n"
},
{
"from": "human",
"value": "from urllib import urlencode\nfrom urllib2 import urlopen\nfrom corehq.apps.sms.util import clean_phone_number\nfrom corehq.apps.sms.models import SQLSMSBackend\nfrom dimagi.ext.couchdbkit import *... | python | chosen |
[
{
"from": "system",
"value": "Make it possible to run tests with --keepdb\n"
},
{
"from": "human",
"value": "from django.test.runner import DiscoverRunner\nfrom django.db import connection\n\nfrom tenant_schemas.utils import get_tenant_model\n\nfrom bluebottle.test.utils import InitProjectDataMi... | python | chosen |
[
{
"from": "system",
"value": "Fix for conflict in opening file\n"
},
{
"from": "human",
"value": "import logging\nfrom logging.handlers import TimedRotatingFileHandler\n\nclass PriestLogger:\n\n\tdef __init__(self):\n\t\tlogHandler = TimedRotatingFileHandler(\"C:\\\\lucas\\\\PriestPy\\\\Dropbox\... | python | chosen |
[
{
"from": "system",
"value": "Make this one role, stage\n"
},
{
"from": "human",
"value": "from fusionbox.fabric_helpers import *\n\nenv.roledefs = {\n 'dev': ['dev.fusionbox.com'],\n }\n\nenv.project_name = 'django-widgy'\nenv.short_name = 'widgy'\nenv.tld = ''\n\n\ndef stage_with... | python | chosen |
[
{
"from": "system",
"value": "Upgrade Fitbit to OAuth 2.0\n"
},
{
"from": "human",
"value": "import foauth.providers\n\n\nclass Fitbit(foauth.providers.OAuth1):\n # General info about the provider\n provider_url = 'https://www.fitbit.com/'\n docs_url = 'https://dev.fitbit.com/'\n cat... | python | chosen |
[
{
"from": "system",
"value": "Update docs for yamldumper test\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\n Unit tests for salt.utils.yamldumper\n'''\n\n# Import python libs\nfrom __future__ import absolute_import, print_function, unicode_literals\n\n# Import Salt Libs\nim... | python | chosen |
[
{
"from": "system",
"value": "Fix pylama isort integration not to include check=True redundly\n"
},
{
"from": "human",
"value": "import os\nimport sys\nfrom contextlib import contextmanager\nfrom typing import Any, Dict, List\n\nfrom pylama.lint import Linter as BaseLinter\n\nfrom . import api\n... | python | chosen |
[
{
"from": "system",
"value": "Update party info after creation\n"
},
{
"from": "human",
"value": "import re\n\nimport requests\nimport lxml.html\n\nfrom parliament.models import PoliticalParty\n\n\ndef create_parties():\n url = 'https://www.tweedekamer.nl/kamerleden/fracties'\n page = requ... | python | chosen |
[
{
"from": "system",
"value": "Fix url regex for no trailing slash\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom django.conf.urls import url\nfrom alapage.views import HomepageView, PageView, PagesmapView\n\n\nurlpatterns = []\n\nurlpatterns.append(\n url(r'^sitemap/$', Pa... | python | chosen |
[
{
"from": "system",
"value": "Remove dummy post from created.py script.\nInitial user now taken from config.\n"
},
{
"from": "human",
"value": "from chalice.extensions import db\nfrom chalice import init_app\nfrom chalice.blog.models import Tag, Post\nfrom chalice.auth.models import User\n\nif _... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Downgraded SSL version to TLS 1 until we have the requests library fixed\"\n\n- TLS1.2 does not work on older pythons (like on MacOSX)\n but it works as intended on current linux versions\n so enable it if possible\n\nThis reverts commit 666630f2a01bdeb7becc3cd3b324c... | python | chosen |
[
{
"from": "system",
"value": "Fix race condition when tracking num_basket_additions on a voucher\n"
},
{
"from": "human",
"value": "from oscar.apps.basket import signals\n\n\ndef track_voucher_addition(basket, voucher, **kwargs):\n voucher.num_basket_additions += 1\n voucher.save()\n\n\nde... | python | chosen |
[
{
"from": "system",
"value": "Update to support SublimeLinter 4\n"
},
{
"from": "human",
"value": "#\n# linter.py\n# Linter for SublimeLinter4, a code checking framework for Sublime Text 3\n#\n# Written by Markus Liljedahl\n# Copyright (c) 2017 Markus Liljedahl\n#\n# License: MIT\n#\n\n\"\"\"Thi... | python | chosen |
[
{
"from": "system",
"value": "Use bash's built-in tcp support, drop dependency on netcat.\n"
},
{
"from": "human",
"value": "import os\nimport socket\nimport subprocess\nimport string\nimport logging\n\nlog = logging.getLogger('terminal')\n\nclass Terminal:\n def __init__(self, tty, socket):\... | python | chosen |
[
{
"from": "system",
"value": "Update function name and return value\n"
},
{
"from": "human",
"value": "import requests\nfrom time import time\n\n\nclass Client:\n def __init__(self, host, requests, do_requests_counter):\n self.host = host\n self.requests = requests\n self... | python | chosen |
[
{
"from": "system",
"value": "Use sub-class of IPython.display.JSON vs. display function\n"
},
{
"from": "human",
"value": "from IPython.display import display\nimport json\n\n\n# Running `npm run build` will create static resources in the static\n# directory of this Python package (and create t... | python | chosen |
[
{
"from": "system",
"value": "Adjust image size to 150k.\n"
},
{
"from": "human",
"value": "import capture\nfrom picamera import PiCamera\nimport time\n\n\ndef image_cap_loop(camera, status=None):\n \"\"\"Set image parameters, capture image, set wait time, repeat\"\"\"\n\n resolution = (85... | python | chosen |
[
{
"from": "system",
"value": "Update skip condition for tests\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\n\"\"\"\n.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>\n\"\"\"\n\nfrom __future__ import print_function, unicode_literals\n\nimport pytest\nfrom simplesqlite imp... | python | chosen |
[
{
"from": "system",
"value": "Use pytest for unit test\n"
},
{
"from": "human",
"value": "import unittest\nfrom mock import Mock\nimport sys\nimport os\nimport datetime\n\nfrom pytrac import Ticket\n\n\nclass TestTicket(unittest.TestCase):\n\n def setUp(self):\n server = Mock()\n ... | python | chosen |
[
{
"from": "system",
"value": "Update test to use Base view\n"
},
{
"from": "human",
"value": "from django.views.generic import View\n\nfrom nap.datamapper.models import ModelDataMapper\nfrom nap.rest import views\n\nfrom .models import Poll\n\n\nclass PollMapper(ModelDataMapper):\n class Meta... | python | chosen |
[
{
"from": "system",
"value": "Refactor model test to test added properties\n"
},
{
"from": "human",
"value": "from context import models\n\nfrom models import model\n\n\nimport unittest\n\nclass test_logic_core(unittest.TestCase):\n def setUp(self):\n self.room = model.Room(20, 'new_ro... | python | chosen |
[
{
"from": "system",
"value": "Change estimated time class to ETC\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\r\nimport statistics\r\n\r\n\r\nclass estimatedtime:\r\n def __init__(self, numberofpoints):\r\n self.listoftimes = []\r\n self.points = numberofpoints\r\n\... | python | chosen |
[
{
"from": "system",
"value": "Remove unneeded properties in base Channel class\n"
},
{
"from": "human",
"value": "from system.translations import Translations\n\n__author__ = 'Sean'\n\n_ = Translations().get()\n\n\nclass Channel(object):\n\n name = \"\"\n users = None\n\n def __init__(s... | python | chosen |
[
{
"from": "system",
"value": "Fix empty argument \"max-empty-rows\" in xls script\nWe send argument \"max-empty-rows\" to two different script. In xls need to set, that this argument is available\n"
},
{
"from": "human",
"value": "import xlrd\nimport json\nimport sys\nimport os\nimport argparse\... | python | chosen |
[
{
"from": "system",
"value": "Add tests for addUsersToGroup function\n"
},
{
"from": "human",
"value": "'''\n Creates all tests to serialize XMLs to xml_curl\n'''\nimport logging\n\nimport pytest\nfrom lxml import etree\nfrom mock import Mock\n\nfrom wirecurly.directory import Domain, User\n ... | python | chosen |
[
{
"from": "system",
"value": "Implement the Python side of Canvas.fillRect\n"
},
{
"from": "human",
"value": "import document\nimport time\nevalstr = '''\nvar a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.respo... | python | chosen |
[
{
"from": "system",
"value": "Change json file to sample one\n"
},
{
"from": "human",
"value": "#coding=utf-8\n\n#imports\nimport pystache as ps\nimport sys\nimport json\nimport imp\nviews = imp.load_source('views', 'swedish/views.py')\n#from views import Invoice\n\ndef main():\n\tconfigFile = \... | python | chosen |
[
{
"from": "system",
"value": "Add method definition generator and some sample for test\n"
},
{
"from": "human",
"value": "import os\nimport json\nimport sys\nfrom pprint import pprint\n\ndef loadJSON(fInput):\n with open(fInput) as f:\n return json.load(f)\n return None\n\nif __name... | python | chosen |
[
{
"from": "system",
"value": "Allow setting up rethinkdb remotely\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nimport rethinkdb as r\nimport argparse\n\n\nparser = argparse.ArgumentParser(description='Set up RethinkDB locally')\nargs = parser.parse_args()\n\nconn = r.connect()\nr.d... | python | chosen |
[
{
"from": "system",
"value": "Change the ugly hack to detect atari\n"
},
{
"from": "human",
"value": "import os\n\nimport gym\nfrom gym.spaces.box import Box\n\nfrom baselines import bench\nfrom baselines.common.atari_wrappers import wrap_deepmind\n\ntry:\n import pybullet_envs\nexcept Import... | python | chosen |
[
{
"from": "system",
"value": "Introduce global template function `url_for_snippet`\n\nUse it to ease the transition to a multisite-capable snippet URL rule system.\n"
},
{
"from": "human",
"value": "\"\"\"\nbyceps.blueprints.snippet.views\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2019... | python | chosen |
[
{
"from": "system",
"value": "Use safe_load in place of load\n"
},
{
"from": "human",
"value": "import yaml\n\ndef load_config(keys=None):\n with open('config.yml', 'r') as yf:\n conf = yaml.load(yf)\n\n if keys is not None:\n return [conf[k] for k in keys]\n\n return conf... | python | chosen |
[
{
"from": "system",
"value": "Disable Flask debug - incompatible with SocketIO\n"
},
{
"from": "human",
"value": "import os\n\n\nclass Config(object):\n DEBUG = True\n # WTF_CSRF_ENABLED = False\n DATABASE_NAME = \"projectp\"\n\n BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ... | python | chosen |
[
{
"from": "system",
"value": "Add support for typescriptreact *.tsx files"
},
{
"from": "human",
"value": "#\n# linter.py\n# Linter for SublimeLinter3, a code checking framework for Sublime Text 3\n#\n# Written by Anton Lavrenov\n# Copyright (c) 2014 Anton Lavrenov\n#\n# License: MIT\n#\n\n\"\"\... | python | chosen |
[
{
"from": "system",
"value": "Refactor the encryption into a function, with some type checking\n"
},
{
"from": "human",
"value": "import requests\n\nfrom cryptography.hazmat.primitives.asymmetric import padding\nfrom cryptography.hazmat.backends import default_backend\nfrom cryptography.hazmat.p... | python | chosen |
[
{
"from": "system",
"value": "Add returning log file content\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport logging\nfrom datetime import datetime\nfrom flask import Flask\n\nfrom update_wrapper import UpdateWrapper\n\nLOG_FILE = datetime.n... | python | chosen |
[
{
"from": "system",
"value": "FIX: Remove a bunch of unnecessary import\n"
},
{
"from": "human",
"value": "#!/usr/bin/python3\n# -*- coding: utf8 -*\n\nimport sys\n\n# Fix for file paths errors\nimport os\nPATH = os.path.dirname(os.path.realpath(__file__))\n\n# Import other files from the projec... | python | chosen |
[
{
"from": "system",
"value": "Use authorized + test_func instead of custom decorator.\n"
},
{
"from": "human",
"value": "from django.utils.decorators import available_attrs\nfrom django.utils.http import urlquote\nfrom django.http import HttpResponse\nfrom django.template import loader, RequestC... | python | chosen |
[
{
"from": "system",
"value": "Improve the proxy module which maps to a module which uses __all__.\n\nThe notes I made in the code apply to all proxy modules which map\nto a module which uses __all__.\n\n"
},
{
"from": "human",
"value": "# proxy \nfrom enthought.enable.pyglet_backend.pyglet_ap... | python | chosen |
[
{
"from": "system",
"value": "Include sublime-keymap files in JSON format tests.\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import\n\nimport fnmatch\nimport os\nimport unittest\n\nfrom . import validate_json_format\n\n\nclass TestSettings(unittest.TestCase):\n def _get... | python | chosen |
[
{
"from": "system",
"value": "Add some more function tests.\n"
},
{
"from": "human",
"value": "from .utils import assert_eval\n\n\ndef test_simple_func():\n assert_eval('(def @a $a 8) (@a)', 1, 8)\n\n\ndef test_simple_func_args():\n assert_eval(\n '(def @a $a $a)'\n '(@a 1)'\... | python | chosen |
[
{
"from": "system",
"value": "Use django for static file only in debug mode\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import *\n\nfrom django.contrib import admin\nfrom django.conf import settings\nadmin.autodiscover()\n\nurlpatterns = patterns('',\n (r'^admin/doc/', i... | python | chosen |
[
{
"from": "system",
"value": "Add an exception useful for prototyping.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n"
},
{
"from": "human",
"value": "\"\"\"\nError heirarchy for stratis cli.\n\"\"\"\n\nclass StratisCliError(Exception):\n \"\"\"\n Top-lev... | python | chosen |
[
{
"from": "system",
"value": "Fix no table named event_id\n"
},
{
"from": "human",
"value": "#-*- coding: utf-8 -*-\nfrom django.shortcuts import render_to_response\nfrom django.shortcuts import get_object_or_404\nfrom django.template import RequestContext\nfrom apps.events.models import Event, ... | python | chosen |
[
{
"from": "system",
"value": "Remove the largest scale; causes severe artifacts in some channels\n"
},
{
"from": "human",
"value": "\nimport sys\n\n'''\nCleans an MS with a single channel given a mask and a model\n'''\n\nvis = sys.argv[4]\nmodel = sys.argv[5]\nmask = sys.argv[6]\n\nout_root = vi... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.