conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Add an entry in URLs configuration for image support.\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url\nfrom django.conf import settings\nfrom django.contrib import admin\n\nfrom wagtail.wagtailadmin import urls as wagtailadmin_urls\nfrom... | python | chosen |
[
{
"from": "system",
"value": "LM: Add population to the tags\n"
},
{
"from": "human",
"value": "\ndef filterTags(attrs):\n res = {}\n\n if 'NAMN' in attrs:\n res['name'] = attrs['NAMN']\n\n if 'TATNR' in attrs:\n res['ref:se:scb'] = attrs['TATNR']\n\n if attrs.get('BEF'... | python | chosen |
[
{
"from": "system",
"value": "Update guide stat script to pass datafile\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# Licensed under a 3-clause BSD style license - see LICENSE.rst\n\nfrom mica.stats import update_guide_stats\nupdate_guide_stats.main()\n\nimport os\ntable_file = mic... | python | chosen |
[
{
"from": "system",
"value": "Return dict object from sentry processor regardless of setting existence\n"
},
{
"from": "human",
"value": "import os\nimport logging\nfrom django.conf import settings\n\nlog = logging.getLogger(__name__)\n\n\ndef static(request):\n \"Shorthand static URLs. In de... | python | chosen |
[
{
"from": "system",
"value": "Add simple parser for os-release to get OS version\n"
},
{
"from": "human",
"value": "# Author: Milan Kubik\n\nimport logging\nimport yaml\n\nfrom ipaqe_provision_hosts.errors import IPAQEProvisionerError\n\nlog = logging.getLogger(__name__)\n\n\nclass ConfigLoadErr... | python | chosen |
[
{
"from": "system",
"value": "Change imports in user registration test.\n"
},
{
"from": "human",
"value": "from factory import Faker, fuzzy\n\nfrom django.contrib.auth import get_user_model\nfrom django.test import TestCase\nfrom django.urls import reverse\n\n\nclass UserRegistrationTestCase(Tes... | python | chosen |
[
{
"from": "system",
"value": "Add TagpoolManager to vumi.application API.\n"
},
{
"from": "human",
"value": "\"\"\"The vumi.application API.\"\"\"\n\n__all__ = [\"ApplicationWorker\", \"SessionManager\"]\n\nfrom vumi.application.base import ApplicationWorker\nfrom vumi.application.session import... | python | chosen |
[
{
"from": "system",
"value": "Make config sync more efficient\n"
},
{
"from": "human",
"value": "import redis_collections\nimport threading\nimport time\nimport __main__\n\n\nclass RedisDict(redis_collections.Dict):\n def __init__(self, **kwargs):\n super().__init__(**kwargs)\n ... | python | chosen |
[
{
"from": "system",
"value": "BUG: Add missing imports in transform module.\n"
},
{
"from": "human",
"value": "from .hough_transform import *\nfrom .radon_transform import *\nfrom .finite_radon_transform import *\nfrom .integral import *\nfrom ._geometric import (warp, warp_coords, estimate_tran... | python | chosen |
[
{
"from": "system",
"value": "[windows] Fix handling of Network Service username.\n\nIn Windows Server 2016 at least, the Network Service user (the one being\nused by the CI machine) is returned as Host$, which icacls doesn't\nunderstand. Turn the name into something that icacls if we get a name\nthat ends ... | python | chosen |
[
{
"from": "system",
"value": "Comment about the hex part"
},
{
"from": "human",
"value": "import glob\nimport os\nimport subprocess\n\n\"\"\"This is used to decompress the news.bin files.\"\"\"\n\ndef decompress(file):\n\twith open(file, \"rb\") as source_file:\n\t\tread = source_file.read()\n\t... | python | chosen |
[
{
"from": "system",
"value": "Reduce the amount of time locking"
},
{
"from": "human",
"value": "import multiprocessing, sys, datetime\n\nprint_lock = multiprocessing.Lock()\ndef safeprint(content):\n with print_lock:\n sys.stdout.write((\"[\" + str(multiprocessing.current_process().pid) + \... | python | chosen |
[
{
"from": "system",
"value": "Fix ordering of category view\n\nSigned-off-by: Michal Čihař <a2df1e659c9fd2578de0a26565357cb273292eeb@cihar.com>\n"
},
{
"from": "human",
"value": "from django.shortcuts import get_object_or_404\nfrom django.views.generic.dates import ArchiveIndexView\nfrom django.... | python | chosen |
[
{
"from": "system",
"value": "Test for environment variable existence\n"
},
{
"from": "human",
"value": "import configobj\nimport validate\nimport os\n\ndef _get_filename():\n \"\"\"Return the configuration file path.\"\"\"\n appname = 'dlstats'\n if os.name == 'posix':\n if os.p... | python | chosen |
[
{
"from": "system",
"value": "Add 'id' to both Serializers\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\nfrom .models import Activity, Datapoint\n\n\nclass ActivitySerializer(serializers.HyperlinkedModelSerializer):\n class Meta:\n model = Activity\n ... | python | chosen |
[
{
"from": "system",
"value": "Revert removing data which is still used\n\nThis was removed in b1bc34e9a83cb3af5dd11baa1236f2b65ab823f9 but is still used in admin.py."
},
{
"from": "human",
"value": "#LIBRARIES\nfrom django.db import models\nfrom django.utils.html import escape\nfrom django.utils... | python | chosen |
[
{
"from": "system",
"value": "Fix error in test suite startup with dotted import names.\n\nDetected first on ubuntu 12.04, but the bug is generic, we just hadn't\nseen it before. Will push straight to master as this will begin\ncausing problems as more people upgrade.\n"
},
{
"from": "human",
"... | python | chosen |
[
{
"from": "system",
"value": "Add aliased ABC for tokens with an alias.\n"
},
{
"from": "human",
"value": "\"\"\"\nSQL generators for Katagawa.\n\"\"\"\nimport abc\nimport typing\n\n\nclass Token(abc.ABC):\n \"\"\"\n Base class for a token.\n \"\"\"\n def __init__(self, subtokens: ty... | python | chosen |
[
{
"from": "system",
"value": "Test that invalid cert crashes export-certificate but not info\n"
},
{
"from": "human",
"value": "import unittest\n\nfrom ..framework import cli_test_suite\nfrom .util import DEFAULT_MANAGEMENT_KEY\n\n\n@cli_test_suite\ndef additional_tests(ykman_cli):\n class Mi... | python | chosen |
[
{
"from": "system",
"value": "Add docstrings and fix call of call_signature.\n\nFor the fix:\ncall_signature has been moved before executing the actual call, if the call is made before then it might change arguments if they are references.\n"
},
{
"from": "human",
"value": "from functools import... | python | chosen |
[
{
"from": "system",
"value": "Fix dns-providers type missing from schema\n"
},
{
"from": "human",
"value": "from marshmallow import fields\n\nfrom lemur.common.fields import ArrowDateTime\nfrom lemur.common.schema import LemurInputSchema, LemurOutputSchema\n\n\nclass DnsProvidersNestedOutputSche... | python | chosen |
[
{
"from": "system",
"value": "Update tests for nbgrader feedback\n"
},
{
"from": "human",
"value": "from .base import TestBase\nfrom nbgrader.api import Gradebook\n\nimport os\n\nclass TestNbgraderFeedback(TestBase):\n\n def _setup_db(self):\n dbpath = self._init_db()\n gb = Gra... | python | chosen |
[
{
"from": "system",
"value": "Make output easier to parse with cli tools.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport sys\nimport redis\nimport redis.exceptions\n\nhost = sys.argv[1]\nhost = host.strip('\\r\\n')\nport = 6379\ntimeout = 5\n\ntry:\n db = redis.StrictRedi... | python | chosen |
[
{
"from": "system",
"value": "Allow multiple --hide options to be used\n\nAlso:\n\timply --team if --hide\n\tmore pythonic\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n\"\"\"\nList repositories on Github belonging to organisations, teams, etc\n\"\"\"\n\n# Technical Debt\n# -------... | python | chosen |
[
{
"from": "system",
"value": "Refactor combat code to be more concise\n"
},
{
"from": "human",
"value": "import places\nfrom character import Character\nimport actions\nimport options\nfrom multiple_choice import MultipleChoice\n\n\ndef combat(character):\n \"\"\"\n takes in a character, r... | python | chosen |
[
{
"from": "system",
"value": "Put module in method to enable calls from libraries.\n\n\nFormer-commit-id: e614cec07ee71723be5b114163fe835961f6811c"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nfrom distutils.core import setup, Extension\n\nMODULES_TO_BUILD = [\"fasthash\", \"suc\", \"... | python | chosen |
[
{
"from": "system",
"value": "Make the unit tests work with 2.6.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2014, Matt Layman\n'''Tests for the StorageFactory.'''\n\nimport unittest\n\nfrom markwiki.exceptions import ConfigurationError\nfrom markwiki.storage.factory import UserStorageFac... | python | chosen |
[
{
"from": "system",
"value": "Make windows bigger in this test so the captions can be read.\n\n\nIndex: tests/window/WINDOW_CAPTION.py\n===================================================================\n--- tests/window/WINDOW_CAPTION.py\t(revision 777)\n+++ tests/window/WINDOW_CAPTION.py\t(working copy)\... | python | chosen |
[
{
"from": "system",
"value": "Adjust deleting cascade for planned liquid transfers"
},
{
"from": "human",
"value": "\"\"\"\nPlanned worklist member table.\n\"\"\"\nfrom sqlalchemy import Column\nfrom sqlalchemy import ForeignKey\nfrom sqlalchemy import Integer\nfrom sqlalchemy import Table\nfrom... | python | chosen |
[
{
"from": "system",
"value": "Refactor Enterprise class to use AuthenticationBase\n"
},
{
"from": "human",
"value": "import requests\n\n\nclass Enterprise(object):\n\n def __init__(self, domain):\n self.domain = domain\n\n def saml_login(self, client_id, connection):\n \"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Add teardown request instead of usesDatabase decorator\n"
},
{
"from": "human",
"value": "import flask\nimport os.path\nimport datetime\nimport urllib.parse\nfrom .. import configmanager\nfrom . import controllers\n\nFILE_LOCATION = os.path.abspath(os.path.dirname(_... | python | chosen |
[
{
"from": "system",
"value": "Change sha fetching to use --parent-only and removed ref parameter\n"
},
{
"from": "human",
"value": "\nimport collections\nimport contextlib\nimport shutil\nimport subprocess\nimport tempfile\n\nfrom util.iter import chunk_iter\n\nCommit = collections.namedtuple('... | python | chosen |
[
{
"from": "system",
"value": "Create derived test data files if they do not exist when running nosetests\n"
},
{
"from": "human",
"value": "#\n"
},
{
"from": "gpt",
"value": "import os\n\nDATADIR = os.path.abspath('docs/data')\nFILES = ['test_uk.shp', 'test_uk.shx', 'test_uk.dbf', 't... | python | chosen |
[
{
"from": "system",
"value": "Rename schema fixture to free up parameter name\n"
},
{
"from": "human",
"value": "from pathlib import Path\n\nimport pytest\nfrom sqlalchemy import create_engine\nfrom testcontainers import PostgresContainer as _PostgresContainer\n\ntests_dir = Path(__file__).paren... | python | chosen |
[
{
"from": "system",
"value": "Sort by longest path (assuming stdlib stuff will be in the longest).\n"
},
{
"from": "human",
"value": "import collections\nimport os\nimport site\nimport sys\nfrom distutils.sysconfig import get_python_lib\n\nSITE_PACKAGES_PATHS = set()\nif hasattr(site, 'getsitepa... | python | chosen |
[
{
"from": "system",
"value": "Add method to get all families of currently loaded elements\n"
},
{
"from": "human",
"value": "class Lattice(object):\n\n def __init__(self, name):\n self.name = name\n self._elements = []\n\n def __getitem__(self, i):\n return self._eleme... | python | chosen |
[
{
"from": "system",
"value": "Remove unused color distance function\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"Functions for converting and comparing colors.\"\"\"\n\nimport colorsys\nimport math\nimport operator\n\n\ndef hls_to_rgb(hue, lightness,... | python | chosen |
[
{
"from": "system",
"value": "Move main execution to function\n"
},
{
"from": "human",
"value": "from urllib.request import urlopen\n\n\ndef fetch_words():\n with urlopen('http://sixty-north.com/c/t.txt') as story:\n story_words = []\n word_list = ''\n for line in story:\... | python | chosen |
[
{
"from": "system",
"value": "Add request parameter to backend.authenticate\n\nWithout this, the signature of our custom backend does not\nmatch that of the function call. This signature is tested\nin django.contrib.auth.authenticate here: https://github.com/django/django/blob/fdf209eab8949ddc345aa0212b349c... | python | chosen |
[
{
"from": "system",
"value": "Rewrite the initial bootstrapping mechanism.\n"
},
{
"from": "human",
"value": "import sys\nimport marshal\nimport os.path\n\n\nif not hasattr(sys, 'implementation'):\n raise ImportError('Python 3.3 or newer is required')\n\nPY_TAG = sys.implementation.cache_... | python | chosen |
[
{
"from": "system",
"value": "Update plugin metadata to the new format\n"
},
{
"from": "human",
"value": "from . import LayerView\n\ndef getMetaData():\n return { \"name\": \"LayerView\", \"type\": \"View\" }\n\ndef register(app):\n return LayerView.LayerView()\n"
},
{
"from": "gp... | python | chosen |
[
{
"from": "system",
"value": "Use correct argument for content type in serve view\n"
},
{
"from": "human",
"value": "import mimetypes\n\nfrom django.http import HttpResponse, HttpResponseNotModified, Http404\nfrom django.contrib.staticfiles.views import serve as staticfiles_serve\nfrom django.vi... | python | chosen |
[
{
"from": "system",
"value": "Use root user to connect\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# igcollect - Mysql Status\n#\n# Copyright (c) 2016, InnoGames GmbH\n#\n\nimport time\nimport socket\nimport MySQLdb\n\nhostname = socket.gethostname().replace(\".\", \"_\")\nnow =... | python | chosen |
[
{
"from": "system",
"value": "Use user's local application data directory instead of the module path.\n"
},
{
"from": "human",
"value": "import os\nimport cPickle as pickle\n\ntry: DATA_DIR = os.path.dirname(os.path.realpath(__file__))\nexcept: DATA_DIR = os.getcwd()\n\n\ncache_path = lambda nam... | python | chosen |
[
{
"from": "system",
"value": "Update to absolute imports in assemblers\n"
},
{
"from": "human",
"value": "try:\n from pysb_assembler import PysbAssembler\nexcept ImportError:\n pass\ntry:\n from graph_assembler import GraphAssembler\nexcept ImportError:\n pass\ntry:\n from sif_ass... | python | chosen |
[
{
"from": "system",
"value": "Add helper method for resetting user data\n"
},
{
"from": "human",
"value": "from web_ui import app\nfrom flask import session\nfrom datetime import datetime\n\n\n# For calculating scores\nepoch = datetime.utcfromtimestamp(0)\nepoch_seconds = lambda dt: (dt - epoch)... | python | chosen |
[
{
"from": "system",
"value": "Refactor str_to_num to be more concise\n\nFunctionally nothing has changed. We just need not try twice nor\ndefine the variable _ twice.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\ndef str_to_num(i, exact_match=True):\n \"\"\"\n Attempts to c... | python | chosen |
[
{
"from": "system",
"value": "FIX produ template tree prices\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n##############################################################################\n# For copyright and license notices, see __openerp__.py file in module root\n# directory\n#####... | python | chosen |
[
{
"from": "system",
"value": "Add test for noop routes\n"
},
{
"from": "human",
"value": "import json\n\nfrom . import TestCase\n\n\nclass MetricsTests(TestCase):\n def test_find(self):\n url = '/metrics/find'\n\n response = self.app.get(url)\n self.assertEqual(response.s... | python | chosen |
[
{
"from": "system",
"value": "Set it to flash black and white every second"
},
{
"from": "human",
"value": "from BlinkyTape import BlinkyTape\n\nbb = BlinkyTape('/dev/tty.usbmodemfa131')\n\nwhile True:\n\n for x in range(60):\n bb.sendPixel(10, 10, 10)\n bb.show()\n\n for x in ra... | python | chosen |
[
{
"from": "system",
"value": "Add function to just print a simple table\n\n"
},
{
"from": "human",
"value": "\"\"\"Helper to output stuff\"\"\"\n\nfrom tabulate import tabulate\n\n\ndef print_list(header, entries):\n \"\"\"Prints out a list\"\"\"\n print(tabulate(entries, header, tablefmt=... | python | chosen |
[
{
"from": "system",
"value": "Update dataframe with counts and serialize\n"
},
{
"from": "human",
"value": "import pandas as pd\nimport shutil\nimport utils as u\nimport validators\nfrom analyzer import Analyzer\nfrom git import Repo\n\nif __name__ == \"__main__\":\n\n repos = pd.read_pickle(... | python | chosen |
[
{
"from": "system",
"value": "Make player creation test check for valid response.\n"
},
{
"from": "human",
"value": "from webtest import TestApp\nimport dropshot\n\ndef test_create_player():\n app = TestApp(dropshot.app)\n params = {'username': 'chapmang',\n 'password': 'deadp... | python | chosen |
[
{
"from": "system",
"value": "Make person list generator output to file\n\nThe console was going beyond the terminal history limit for 14-15\n"
},
{
"from": "human",
"value": "# Console outputs a person list\n\nimport os\nimport csv\n\nwith open('tmp/person_list_input.csv') as csvfile:\n csvr... | python | chosen |
[
{
"from": "system",
"value": "Fix Python import path on Travis.\n"
},
{
"from": "human",
"value": "from pelicanconf import *\n\n# Over-ride so there is paging.\nDEFAULT_PAGINATION = 5\n"
},
{
"from": "gpt",
"value": "import sys\n# Hack for Travis, where local imports don't work.\nif ... | python | chosen |
[
{
"from": "system",
"value": "Allow blank zotero url reference, but require zotero json data\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom editorsnotes.main.models import Document\nimport utils\nimport json\n\nclass ZoteroLink(models.Model):\n doc = models.OneToOneFiel... | python | chosen |
[
{
"from": "system",
"value": "Remove TestGame.log() method as log() isn't a method of Game anymore\n"
},
{
"from": "human",
"value": "from pygametemplate import Game\nfrom example_view import ExampleView\n\n\nclass TestGame(Game):\n \"\"\"An altered Game class for testing purposes.\"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Add a Status enum and documentation\n"
},
{
"from": "human",
"value": "from mongoengine import Document, DateTimeField, EmailField, IntField, \\\n ReferenceField, StringField\nimport datetime, enum\n\nclass Priority(enum.IntEnum):\n LOW = 0,\n MIDDLE = 1,\... | python | chosen |
[
{
"from": "system",
"value": "RF: Use __file__ instead of inspect, for compatibility with frozen environments\n"
},
{
"from": "human",
"value": "import os\nimport inspect\n\n# find the current absolute path using inspect\n_pwd = os.path.dirname(\n os.path.abspath(\n inspect.getfile(\n ... | python | chosen |
[
{
"from": "system",
"value": "Make the warning for SQLite not being supported a print instead of an exception.\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom fabtastic.db import util\n\ndb_engine = util.get_db_setting('ENGINE')\n\nif 'postgresql_psycopg2' in db_engine:... | python | chosen |
[
{
"from": "system",
"value": "Simplify nethack protocol to a single method.\n"
},
{
"from": "human",
"value": "\"\"\"\nAn example client. Run simpleserv.py first before running this.\n\"\"\"\n\nimport json\n\nfrom twisted.internet import reactor, protocol\n\n\n# a client protocol\n\nclass EchoCl... | python | chosen |
[
{
"from": "system",
"value": "TST: Test sqlite and mongoquery variations.\n"
},
{
"from": "human",
"value": "import os\nimport tempfile\nimport shutil\nimport tzlocal\nimport pytest\nfrom ..mongoquery.mds import MDS\n\n\n@pytest.fixture(params=[1], scope='function')\ndef mds_all(request):\n '... | python | chosen |
[
{
"from": "system",
"value": "Improve the way that import middlewares\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import, unicode_literals\n\n\nfrom flask import Flask\n\nfrom .middleware.me import me\nfrom .cache import ca... | python | chosen |
[
{
"from": "system",
"value": "Remove comment on attaching cloud debugger"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nimport os\nimport sys\n\n\n# Attach Python Cloud Debugger\nif __name__ == \"__main__\":\n #import warnings\n #warnings.filterwarnings('ignore', message=r'Module ... | python | chosen |
[
{
"from": "system",
"value": "Implement equality check for DraftText nodes\n\nCompare the (cached) rendered html of a node\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, unicode_literals\n\nimport json\n\nfrom draftjs_exporter.html import HTML\n\nfrom wagtail.wagtailc... | python | chosen |
[
{
"from": "system",
"value": "Remove sphinx pinning since 1.7.6 has been released.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom setuptools import setup, find_packages\n\n\nsetup(\n name='synapse',\n version='0.1.0a1',\n description='Synapse Distributed Key-Value Hyperg... | python | chosen |
[
{
"from": "system",
"value": "Bump flask from 0.10.1 to 1.0\n\nBumps [flask](https://github.com/pallets/flask) from 0.10.1 to 1.0.\n- [Release notes](https://github.com/pallets/flask/releases)\n- [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst)\n- [Commits](https://github.com/pallets/flas... | python | chosen |
[
{
"from": "system",
"value": "Change the name of the package\n\nFull length 'version'.\nAdd 'classifiers' and 'keywords'.\nInclude files in MANIFEST.in in the dist.\n"
},
{
"from": "human",
"value": "from setuptools import setup\n\nsetup(\n name='libgen',\n version='0.1',\n license='MIT... | python | chosen |
[
{
"from": "system",
"value": "Add util to temporarily alter log levels\n\nAlso backport ContextDecorator from python 3. I saw this just the other\nday and it looks like an awesome pattern, and a much clearer way to\nwrite decorators.\n"
},
{
"from": "human",
"value": "from functools import wrap... | python | chosen |
[
{
"from": "system",
"value": "Add limitations to package documentation\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# encoding: utf8\n\n\"\"\"An Enigma machine simulator with rich textual display functionality.\"\"\"\n\nfrom ._version import __version__, __author__\n#__all__ = ['mac... | python | chosen |
[
{
"from": "system",
"value": "Add test to check title of index\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nfrom selenium import webdriver\nimport unittest\n\n\nclass AdminPageTest(unittest.TestCase):\n\n def setUp(self):\n self.browser = webdriver.Firefox()\n se... | python | chosen |
[
{
"from": "system",
"value": "Use wiringPiSetupGpio, which required root. With wiringPiSetupSys some gpios stayed on low after boot.\n"
},
{
"from": "human",
"value": "import time\nimport os\nimport wiringpi\nfrom garden_lighting.MCP23017.MCP23017 import MCP23017\n\n\nclass RaspberryMCP23017(MCP... | python | chosen |
[
{
"from": "system",
"value": "Update main to run a profiler\n\nSigned-off-by: Dan McGee <a6e5737275ff1276377ee261739f3ee963671241@gmail.com>\n"
},
{
"from": "human",
"value": "import sys\n\nfrom . import BinaryData\n\nfor filename in sys.argv[1:]:\n with open(filename) as infile:\n dat... | python | chosen |
[
{
"from": "system",
"value": "Enable filtering OpenStack package by tenant.\n"
},
{
"from": "human",
"value": "import django_filters\n\nfrom nodeconductor.core.filters import UUIDFilter\n\nfrom . import models\n\n\nclass PackageTemplateFilter(django_filters.FilterSet):\n name = django_filters... | python | chosen |
[
{
"from": "system",
"value": "Add import os in lmod to fix regression\n"
},
{
"from": "human",
"value": "from functools import partial\nfrom os import environ\nfrom subprocess import Popen, PIPE\n\nLMOD_SYSTEM_NAME = environ.get('LMOD_SYSTEM_NAME', '')\n\ndef module(command, *args):\n cmd = (... | python | chosen |
[
{
"from": "system",
"value": "Add filter on the town field on the Farmer model\n"
},
{
"from": "human",
"value": "from rest_framework import viewsets\n\nfrom .models import Farmer\nfrom .serializers import FarmerSerializer\n\n\nclass FarmerViewSet(viewsets.ReadOnlyModelViewSet):\n queryset = ... | python | chosen |
[
{
"from": "system",
"value": "Allow mongo returner to update a password protected mongo database.\n"
},
{
"from": "human",
"value": "'''\nReturn data to a mongodb server\n\nThis is the default interface for returning data for the butter statd subsytem\n'''\n\nimport logging\nimport pymongo\n\nlo... | python | chosen |
[
{
"from": "system",
"value": "Use usubscribe rather than popping the broadcaster\n"
},
{
"from": "human",
"value": "import json\nimport tornadoredis.pubsub\nimport tornadoredis\nfrom .base_provider import BaseProvider\n\n\nclass RedisSubProvider(BaseProvider):\n def __init__(self):\n s... | python | chosen |
[
{
"from": "system",
"value": "Use requests instead of urllib.request\n"
},
{
"from": "human",
"value": "\nimport urllib.request\n\n\nclass WebAdapter:\n def get(self, urllike):\n url = self.mk_url(urllike)\n try:\n res = urllib.request.urlopen(url)\n return... | python | chosen |
[
{
"from": "system",
"value": "Use ros-logging instead of print\n"
},
{
"from": "human",
"value": "import math\n\nfrom dynamic_stack_decider.abstract_action_element import AbstractActionElement\n\n\nclass PatternSearch(AbstractActionElement):\n def __init__(self, blackboard, dsd, parameters=No... | python | chosen |
[
{
"from": "system",
"value": "Improve printing in bucky's DebugClient\n"
},
{
"from": "human",
"value": "import sys\n\nfrom bucky.client import Client\n\n\nclass DebugClient(Client):\n out_path = None\n\n def __init__(self, cfg, pipe):\n super(DebugClient, self).__init__(pipe)\n ... | python | chosen |
[
{
"from": "system",
"value": "chore: Order HTTP methods in constant.\n"
},
{
"from": "human",
"value": "\"\"\"\n=============================\naiohttp_middlewares.constants\n=============================\n\nCollection of constants for ``aiohttp_middlewares`` project.\n\n\"\"\"\n\n#: Set of idemp... | python | chosen |
[
{
"from": "system",
"value": "Update UI preferences model (dict)\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"\nResource information of host\n\"\"\"\n\n\ndef get_name():\n \"\"\"\n Get name of this resource\n\n :return: name of this resource\n... | python | chosen |
[
{
"from": "system",
"value": "Fix test http server, change to echo back request body"
},
{
"from": "human",
"value": "import SimpleHTTPServer\nimport BaseHTTPServer\n\nclass Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):\n def do_POST(s):\n s.send_response(200)\n s.end_head... | python | chosen |
[
{
"from": "system",
"value": "Change IRFieldClassic to use 'encoded_str_type'\n"
},
{
"from": "human",
"value": "# Copyright (c) 2017 Timothy Savannah under LGPL version 2.1. See LICENSE for more information.\n#\n# fields.classic - The IRField type which behaves like the \"classic\" IndexedRedis... | python | chosen |
[
{
"from": "system",
"value": "Allow column to be a property\n"
},
{
"from": "human",
"value": "from django import template\n\nregister = template.Library()\n\ndef field_verbose_name(obj, field):\n \"\"\"Usage: {{ object|get_object_field }}\"\"\"\n\n return obj._meta.get_field(field).verbos... | python | chosen |
[
{
"from": "system",
"value": "Update form to handle home_lon and home_lat\n"
},
{
"from": "human",
"value": "from django.forms import ModelForm, widgets\n\nfrom .models import Fellow, Event, Expense, Blog\n\nclass FellowForm(ModelForm):\n class Meta:\n model = Fellow\n exclude =... | python | chosen |
[
{
"from": "system",
"value": "Add CommCare, CommTrack filters for DomainES\n"
},
{
"from": "human",
"value": "from .es_query import HQESQuery\nfrom . import filters\n\n\nclass DomainES(HQESQuery):\n index = 'domains'\n\n @property\n def builtin_filters(self):\n return [\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix FindDepotToolsInPath not working in some cases\n\nWhen depot tools' path in PATH is like '/home/project/depot_tools/',\nFindDepotToolsInPath will not detect it because os.path.basename will\nget empty string.\n\nFix this by getting its parent if its basename is empty.\n\nBU... | python | chosen |
[
{
"from": "system",
"value": "Add downgrade started applications migration\n"
},
{
"from": "human",
"value": "\"\"\"populate application_settings with started apps\n\nRevision ID: f0c9c797c230\nRevises: 31850461ed3\nCreate Date: 2017-02-16 01:02:02.951573\n\n\"\"\"\n\n# revision identifiers, use... | python | chosen |
[
{
"from": "system",
"value": "Use a queryset to display only kind=page\n"
},
{
"from": "human",
"value": "from django.views.generic import DetailView\nfrom models import InfoPage\n\nclass InfoPageView(DetailView):\n \"\"\"Show the page, or 'index' if no slug\"\"\"\n model = InfoPage\n"
}... | python | chosen |
[
{
"from": "system",
"value": "Add missing translation on logging contrib app\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.conf import settings\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom opps.cor... | python | chosen |
[
{
"from": "system",
"value": "Remove debug code from staticgen views.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom staticgen.staticgen_pool import staticgen_pool\nfrom staticgen.staticgen_views import StaticgenView\n\nfrom .models ... | python | chosen |
[
{
"from": "system",
"value": "Fix V2 hypervisor server schema attribute\n\nNova v2 hypervisor server API return attribute \"uuid\" in response's\nserver dict. Current response schema does not have this attribute instead\nit contain \"id\" which is wrong.\n\nThis patch fix the above issue.\n\nNOTE- \"uuid\" ... | python | chosen |
[
{
"from": "system",
"value": "Use os_helper to fix ImportError in Python 3.10\n"
},
{
"from": "human",
"value": "try:\n from test.support.os_helpers import FS_NONASCII\nexcept ImportError:\n from test.support import FS_NONASCII # noqa\n"
},
{
"from": "gpt",
"value": "try:\n ... | python | chosen |
[
{
"from": "system",
"value": "Add missing import to utility python script\n\nBUG=\nR=kustermann@google.com\n\nReview URL: https://codereview.chromium.org//1222793010.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#\n# Copyright (c) 2012, the Dart project authors. Please see the AUTH... | python | chosen |
[
{
"from": "system",
"value": "Use Tracking DB Service URL rather than localhost in the DB connection string.\n"
},
{
"from": "human",
"value": "import pandas as pd\nimport sys\n\n\ndf = pd.read_csv(sys.argv[1])\ndf.columns = [c.lower() for c in df.columns]\n\nfrom sqlalchemy import create_engine... | python | chosen |
[
{
"from": "system",
"value": "Make x axis label samples for now, though eventually should have a date option\n"
},
{
"from": "human",
"value": "#!/usr/bin/python\n\nimport argparse\nimport matplotlib.pyplot as plt\nfrom pylab import *\nfrom osta.osta import *\n\n############\n### MAIN ###\n#####... | python | chosen |
[
{
"from": "system",
"value": "Remove verbose keywork for pip install\n"
},
{
"from": "human",
"value": "from datetime import datetime\nimport logging\n\nfrom path_helpers import path\nfrom pip_helpers import install\n\n\nif __name__ == '__main__':\n logging.basicConfig(level=logging.INFO)\n ... | python | chosen |
[
{
"from": "system",
"value": "Update wording on path of the image.\n"
},
{
"from": "human",
"value": "from django.db import models\n\nfrom django_extensions.db.fields import (\n AutoSlugField, CreationDateTimeField, ModificationDateTimeField)\n\nfrom us_ignite.advertising import managers\n\n\... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.