conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Set token and secret by default\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom uuid import uuid4\nimport hashlib\n\n\ndef _get_rand_hash():\n uid = uuid4()\n return hashlib.sha1(str(uid)).hexdigest()\n\n\ndef generate_token_secret():\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove redundant import of tkinter.\n"
},
{
"from": "human",
"value": "from test import support\n# Skip test if _tkinter wasn't built.\nsupport.import_module('_tkinter')\n\nimport tkinter\nfrom tkinter.test import runtktests\nimport unittest\n\n\nimport tkinter\n\nt... | python | chosen |
[
{
"from": "system",
"value": "Change simulated around for existing modules"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# We're going to simulate how evolution_master should import things\n\nfrom genes import golang\nfrom genes import web_cli\n\n# etc...\n"
},
{
"from": "gpt",... | python | chosen |
[
{
"from": "system",
"value": "Add size and len finctions.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nclass Node(object):\n \"\"\" \"\"\"\n def __init__(self, value, pointer=None):\n self.value = value\n self.pointer = pointer\n\n\nclass LinkedList(object)... | python | chosen |
[
{
"from": "system",
"value": "Insert unused import to test pyflakes in travis\n"
},
{
"from": "human",
"value": "from django.conf.urls import patterns, url, include\n\n\nurlpatterns = patterns('',\n url(r'', include(patterns('',\n url(r'^$', include('serrano.resources')),\n url(... | python | chosen |
[
{
"from": "system",
"value": "Allow api_url in the script to be configurable\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nfrom __future__ import print_function\n\nimport multyvac\n\nmultyvac.config.set_key(api_key='admin', api_secret_key='12345', api_url='http://docker:8000/v1')\n... | python | chosen |
[
{
"from": "system",
"value": "Modify ffmpeg path heroku 2\n"
},
{
"from": "human",
"value": "# Retrieve file from Facebook\n\nimport urllib, convert, re, os\n# from speech_py import speech_to_text_offline as STT_o\n# from speech_py import speech_to_text_google as STT\nfrom speech_py import speec... | python | chosen |
[
{
"from": "system",
"value": "TST: Use python3 for test_docstring_optimization_compat subprocess\n"
},
{
"from": "human",
"value": "import subprocess\n\nimport pytest\n\nfrom statsmodels.compat.platform import PLATFORM_WIN\nfrom statsmodels.compat.scipy import SCIPY_11\n\n\ndef test_lazy_imports... | python | chosen |
[
{
"from": "system",
"value": "Include colons in URL matching"
},
{
"from": "human",
"value": "from plugins.categories import ISilentCommand\n\ntry:\n import requests_pyopenssl\n from requests.packages.urllib3 import connectionpool\n connectionpool.ssl_wrap_socket = requests_pyopenssl.ss... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Update python frame processor test harness to send IPC JSON messages to frame receiver for testing of control path and channel multiplexing\"\n\nThis reverts commit 0e301d3ee54366187b2e12fa5c6927f27e907347.\n"
},
{
"from": "human",
"value": "from frame_rece... | python | chosen |
[
{
"from": "system",
"value": "Update text to reflect current usage\n"
},
{
"from": "human",
"value": "\"\"\"\n MoinMoin - Ref Macro\n\n Collect and emit footnotes. Note that currently footnote\n text cannot contain wiki markup.\n\n @copyright: 2011 Jason L. Wright <jason@thought.net>... | python | chosen |
[
{
"from": "system",
"value": "Use correct order of arguments of pgettext\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n# This file is part of wger Workout Manager.\n#\n# wger Workout Manager is free software: you can redistribute it and/or modify\n# it under the terms of the GNU ... | python | chosen |
[
{
"from": "system",
"value": "Use email to 'print' a person\n"
},
{
"from": "human",
"value": "from django.core.urlresolvers import reverse\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nclass Person(models.Model):\n first_name = models.CharField(ver... | python | chosen |
[
{
"from": "system",
"value": "Move django admin to /_admin\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.conf.urls import include, url\nfrom django.conf.urls.static import static\nfrom django.contrib import admin\n\n\nurlpatterns = [\n url(r'^admin/', admin.... | python | chosen |
[
{
"from": "system",
"value": "Add support for extracting the token from request headers\n\nClients can now set the `Api-Token` header instead of supplying the\ntoken as a GET or POST parameter."
},
{
"from": "human",
"value": "from functools import wraps\nfrom django.conf import settings\nfrom d... | python | chosen |
[
{
"from": "system",
"value": "Fix evolution for change description users\n\nTrivial change\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django_evolution.mutations import AddField\nfrom django.db import models\n\n\nMUTATIONS = [\n AddField('ChangeDescripti... | python | chosen |
[
{
"from": "system",
"value": "Update tests to explicitly account for previous\n"
},
{
"from": "human",
"value": "from spec import Spec, skip, ok_, eq_, raises\n\nfrom invoke.parser import Parser, Context, Argument\nfrom invoke.collection import Collection\n\n\nclass Parser_(Spec):\n def has_a... | python | chosen |
[
{
"from": "system",
"value": "Remove now useless test for initial sites value in form\n"
},
{
"from": "human",
"value": "\"\"\"Test cases for Zinnia's admin forms\"\"\"\nfrom django.test import TestCase\nfrom django.contrib.admin.widgets import RelatedFieldWidgetWrapper\n\nfrom zinnia.models imp... | python | chosen |
[
{
"from": "system",
"value": "Make sockets listen to parent namespaces as well.\n\nFor example, /live/test will now receive messages destined for\n/live/test, /live and /. This allows us to send messages to multiple\nendpoints at once such as refreshing all liveupdate threads or the like.\n"
},
{
"... | python | chosen |
[
{
"from": "system",
"value": "Fix stupid bug in the client creation script\n\nbool(String) doesn't actually convert a string to a boolean.\nSo we were creating a new ID even if the user typed in \"False\".\nFixed with a simple boolean check instead.\n"
},
{
"from": "human",
"value": "from dao.cl... | python | chosen |
[
{
"from": "system",
"value": "telemetry: Fix an import path in the Android screen recorder\n\nReview URL: https://codereview.chromium.org/1301613004\n\nCr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#343960}\n"
},
{
"from": "human",
"value": "# Copyright 2013 The Chromium Authors.... | python | chosen |
[
{
"from": "system",
"value": "Change TestCase from unittest to django.test\n"
},
{
"from": "human",
"value": "from unittest import TestCase\nfrom physical.tests.factory import PlanFactory, DatabaseInfraFactory, InstanceFactory\n\n\nclass TestBaseStep(TestCase):\n\n def setUp(self):\n s... | python | chosen |
[
{
"from": "system",
"value": "Build vehicle with motor hat.\n"
},
{
"from": "human",
"value": "from Adafruit_MotorHAT import Adafruit_MotorHAT\n\n\nclass Vehicle:\n def __init__(self, motor_hat=None):\n self.motor_hat = motor_hat\n self.motors = []\n\n def release(self):\n ... | python | chosen |
[
{
"from": "system",
"value": "Allow IntegrityError to propagate with duplicate email\n\nFixes #62. When ACCOUNT_EMAIL_UNIQUE is True we should fail loudly when an\nattempt to insert a duplicate occurs. Let the callers handle the failure.\n"
},
{
"from": "human",
"value": "from __future__ import ... | python | chosen |
[
{
"from": "system",
"value": "Enable searching in task list by label.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\nimport django.forms as forms\nfrom django.db.models import Q\n\n\nclass TaskSearchForm(forms.Form):\n search = forms.CharField(required=False)\n my = form... | python | chosen |
[
{
"from": "system",
"value": "Load kombu root module lazily\n"
},
{
"from": "human",
"value": "\"\"\"AMQP Messaging Framework for Python\"\"\"\nVERSION = (1, 0, 0, \"rc4\")\n__version__ = \".\".join(map(str, VERSION[0:3])) + \"\".join(VERSION[3:])\n__author__ = \"Ask Solem\"\n__contact__ = \"ask... | python | chosen |
[
{
"from": "system",
"value": "Fix a very small typo in the name of the test.\n\nTest name has been changed from test_gaurdian to test_guardian, to reflect Guardian website name"
},
{
"from": "human",
"value": "import unittest\n\nfrom domain_parser import domain_parser\n\nclass DomainParserTestCa... | python | chosen |
[
{
"from": "system",
"value": "Change license according to project license\n"
},
{
"from": "human",
"value": "# -----------------------------------------------------------------------------\n# Created: 04.03.2014\n# Copyright: (c) Josua Schmid 2014\n# Licence: GPLv3\n#\n# Sample script ... | python | chosen |
[
{
"from": "system",
"value": "Switch to .run from .start to avoid confusion with an incoming command\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\r\n# -*- coding: utf-8 -*-\r\nimport argparse\r\nimport importlib\r\n\r\nfrom .. import robots\r\n\r\nif __name__ == '__main__':\r\n p... | python | chosen |
[
{
"from": "system",
"value": "Update project version to 1.7.3\n"
},
{
"from": "human",
"value": "__version__ = '1.7.2'\n__copyright__ = 'Copyright (c) 2020, Skioo SA'\n__licence__ = 'MIT'\n__URL__ = 'https://github.com/skioo/django-customer-billing'\n"
},
{
"from": "gpt",
"value": "_... | python | chosen |
[
{
"from": "system",
"value": "Send all user data to the slack\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\nimport os\nimport django\nfrom fitbit.slack import post_message\n\nIDS_TO_POST = os.environ['AUTOPOST'].split(',')\n\nif __name__ == '__main__':\n os.environ.setdefault(\... | python | chosen |
[
{
"from": "system",
"value": "Add test for predicate composition\n"
},
{
"from": "human",
"value": "\"\"\"Test the functions in the tools file.\"\"\"\n\nimport bibpy.tools\n\n\ndef test_version_format():\n assert bibpy.tools.version_format().format('0.1.0') == '%(prog)s v0.1.0'\n\n program... | python | chosen |
[
{
"from": "system",
"value": "Update sample good page to test changes from 1 to 2 digits\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom mangacork import utils\n\n@pytest.fixture\ndef sample_page_bad_format():\n sample_page = {'chapter': \"chapter1\", 'page': 3}\n return sample_pa... | python | chosen |
[
{
"from": "system",
"value": "Remove non-required column from test.\n"
},
{
"from": "human",
"value": "from pyxform.tests_v1.pyxform_test_case import PyxformTestCase\n\n\nclass AuditTest(PyxformTestCase):\n def test_audit(self):\n self.assertPyxformXform(\n name=\"meta_audit... | python | chosen |
[
{
"from": "system",
"value": "Set flash message *after* message sending\n"
},
{
"from": "human",
"value": "# coding: utf-8\n\n\nfrom django.core.urlresolvers import reverse\nfrom django.views.generic import CreateView\nfrom django.utils.translation import ugettext_lazy as _\nfrom django.contrib ... | python | chosen |
[
{
"from": "system",
"value": "Update for new version of micropython for microbit\n"
},
{
"from": "human",
"value": "# Light LEDs at 'random' and make them fade over time\n#\n# Usage:\n#\n# led_dance(speed)\n#\n# 'speed' is the time between each new LED being turned on. Note that the\n# random... | python | chosen |
[
{
"from": "system",
"value": "Allow settings to override default lengths.\n"
},
{
"from": "human",
"value": "from django.utils.translation import ugettext_lazy as _\n\nKEY_SIZE = 16\nSECRET_SIZE = 16\nVERIFIER_SIZE = 10\nCONSUMER_KEY_SIZE = 256\nMAX_URL_LENGTH = 2083 # http://www.boutell.com/new... | python | chosen |
[
{
"from": "system",
"value": "Test for reading a wave file asserts that the essence is set.\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom adam.adam import *\n\ndef test_contains_asset():\n storage = AssetStorage()\n a = Asset()\n storage['key'] = a\n assert storage['key'] ... | python | chosen |
[
{
"from": "system",
"value": "Test for custom option class\n"
},
{
"from": "human",
"value": "import sys\n\nfrom skeletor import config\nfrom skeletor.config import Config\n\nfrom .base import BaseTestCase\nfrom .helpers import nostdout\n\n\nclass OptsTests(BaseTestCase):\n\n def test_somethi... | python | chosen |
[
{
"from": "system",
"value": "Test case for tent map time series\n\nGenerate a time series with both a monionically increase and decreasing\nsections.\n"
},
{
"from": "human",
"value": "from wordgraph.points import Point\nimport wordgraph\n\nEPOCH_START = 1407109280\n\ndef time_values(values, st... | python | chosen |
[
{
"from": "system",
"value": "Update query init file docstring.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nInitialisation file for query directory.\n\"\"\"\n"
},
{
"from": "gpt",
"value": "# -*- coding: utf-8 -*-\n\"\"\"\nInitialisation file for query directo... | python | chosen |
[
{
"from": "system",
"value": "Fix paths in mail out email management command\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.core.mail import EmailMessage\nfrom django.core.management.base import BaseCommand\nfrom django.template.loader import render_to_string\n\... | python | chosen |
[
{
"from": "system",
"value": "Add qty when searching seller because even if not passed a verification is made by default in _select_seller\n"
},
{
"from": "human",
"value": "# Copyright (C) 2021 Akretion (http://www.akretion.com).\n\nfrom odoo import _, exceptions, models\n\n\nclass PurchaseOr... | python | chosen |
[
{
"from": "system",
"value": "Python: Add example of QuerySet chain (django)\n"
},
{
"from": "human",
"value": "from django.db import connection, models\nfrom django.db.models.expressions import RawSQL\n\n\ndef test_plain():\n cursor = connection.cursor()\n cursor.execute(\"some sql\") # ... | python | chosen |
[
{
"from": "system",
"value": "Update ECR per 2020-12-18 and 2021-02-04 changes\n"
},
{
"from": "human",
"value": "from . import AWSObject, AWSProperty, Tags\nfrom .compat import policytypes\n\n\nclass LifecyclePolicy(AWSProperty):\n props = {\n 'LifecyclePolicyText': (basestring, False... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Properly handle non-hex characters in MAC\"\n\nThis reverts commit 2734a3f0212c722fb9fe3698dfea0dbd8a14faa7.\n"
},
{
"from": "human",
"value": "import re\nfrom django import forms\n\n\nmac_pattern = re.compile(\"^[0-9a-f]{12}$\")\n\n\nclass MacAddrFormField... | python | chosen |
[
{
"from": "system",
"value": "Put the crawled link into the database\n"
},
{
"from": "human",
"value": "import requests\rimport re\rimport os\r\rurl = \"https://www.autohome.com.cn/shanghai/\"\rurlBox = []\rdef catchURL(url):\r file = requests.get(url,timeout=2)\r data = file.content\r ... | python | chosen |
[
{
"from": "system",
"value": "Make version format PEP 440 compatible\n"
},
{
"from": "human",
"value": "import collections\nimport re\nimport sys\n\n\n__version__ = '0.1.2'\n\nversion = __version__ + ' , Python ' + sys.version\n\n\nVersionInfo = collections.namedtuple('VersionInfo',\n ... | python | chosen |
[
{
"from": "system",
"value": "Return invalid if payment method is not supported yet\n"
},
{
"from": "human",
"value": "from mhvdb2.models import Payment, Entity\nimport re\nfrom datetime import datetime\nfrom peewee import DoesNotExist\n\n\ndef validate(amount, email, method, type, notes, refere... | python | chosen |
[
{
"from": "system",
"value": "Speed up argument completions by not loading all command packages unless we have to...\n"
},
{
"from": "human",
"value": "import sys\n\nimport azure.cli.main\n\nfrom azure.cli._telemetry import init_telemetry, user_agrees_to_telemetry, telemetry_flush\n\ntry:\n ... | python | chosen |
[
{
"from": "system",
"value": "Exclude psi domains or this takes forever\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\nfrom corehq.apps.locations.models import Location\nfrom dimagi.utils.couch.database import iter_docs\nfrom datetime import datetime\n\nc... | python | chosen |
[
{
"from": "system",
"value": "Set development version to v0.3.0.dev0\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# -----------------------------------------------------------------------------\n# Copyright (c) Spyder Project Contributors\n#\n# Licensed under the terms of the MIT ... | python | chosen |
[
{
"from": "system",
"value": "Add field (not working yet) for Tor exit node selection\n"
},
{
"from": "human",
"value": "from var import *\nfrom ui_elements import *\nfrom gi.repository import Gtk\nfrom torctl import *\n\n# ORGANIZATION OF THESE LISTS:\n# 1. Main list for all the elements\n# 2. ... | python | chosen |
[
{
"from": "system",
"value": "Remove stray comment, update docstring and minor PEP8 changes\n"
},
{
"from": "human",
"value": "\"\"\"\nA collection of classes used to manipulate Police KML data, used with prepgml4ogr.py.\n\"\"\"\nimport os\nfrom lxml import etree\n\nclass prep_kml():\n\n def ... | python | chosen |
[
{
"from": "system",
"value": "Use glamkit settings as default in glamkit branch.\n"
},
{
"from": "human",
"value": "# Do not commit secrets to VCS.\n\n# Local environment variables will be loaded from `.env.local`.\n# Additional environment variables will be loaded from `.env.$DOTENV`.\n# Local ... | python | chosen |
[
{
"from": "system",
"value": "Add RQ exception handler to report to SNS topic\n"
},
{
"from": "human",
"value": "'''A custom rq worker class to add start & stop SNS messages to all jobs'''\n\nimport logging\nfrom rq.worker import Worker\nfrom harvester.sns_message import publish_to_harvesting\n\... | python | chosen |
[
{
"from": "system",
"value": "Add validation in category and get_slug in post\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.template.defaultfilters import slugify\nfrom django.core.urlresolvers import reverse_lazy\n\nclass Category(models.Model):\n title = model... | python | chosen |
[
{
"from": "system",
"value": "Update log output so that it works more nicely with ELK\n"
},
{
"from": "human",
"value": "import logging\nimport logging.handlers\n\n\n# ######### Set up logging ##########\n# log.basicConfig(format=\"%(asctime)s - %(levelname)s: %(message)s\", level=log.DEBUG)\nlo... | python | chosen |
[
{
"from": "system",
"value": "Add custom Hastack get_identifier function\n"
},
{
"from": "human",
"value": "import re\n\n\ndef minify(template_source):\n template_source = re.sub(r'(\\n *)+', '\\n', template_source)\n template_source = re.sub(r'({%.+%})\\n+', r'\\1', template_source)\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix threaded run of the new event loop"
},
{
"from": "human",
"value": "\"\"\"\n\nVery basic implementation of an event loop\n==========================================\n\nThe eventloop is a singleton to schedule and run events.\n\nExports\n-------\n\n- ``EventLoop`... | python | chosen |
[
{
"from": "system",
"value": "Set version to 1.2.2 final\n"
},
{
"from": "human",
"value": "__version_info__ = (1, 3, 0, 'dev')\n\n\n# Dot-connect all but the last. Last is dash-connected if not None.\n__version__ = '.'.join([str(i) for i in __version_info__[:-1]])\nif __version_info__[-1] is no... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Progressing dots to show test is running\"\n\nBreaks tests; https://travis-ci.org/wikimedia/pywikibot-core/builds/26752150\n\nThis reverts commit 93379dbf499c58438917728b74862f282c15dba4.\n\nChange-Id: Iacb4cc9e6999d265b46c558ed3999c1198f87de0\n"
},
{
"from": "... | python | chosen |
[
{
"from": "system",
"value": "Add test to check python version\n"
},
{
"from": "human",
"value": "import unittest\nimport os, sys\n\nPROJECT_ROOT = os.path.dirname(__file__)\nsys.path.append(os.path.join(PROJECT_ROOT, \"..\"))\n\nfrom CodeConverter import CodeConverter\n\nclass TestBasic(unittes... | python | chosen |
[
{
"from": "system",
"value": "Improve how child hooks are run in FeedForward\n"
},
{
"from": "human",
"value": "from .model import Model\n\n\nclass FeedForward(Model):\n '''A feed-forward network, that chains multiple Model instances together.'''\n def __init__(self, layers, **kwargs):\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix tag and article connections\n"
},
{
"from": "human",
"value": "import graphene\nfrom graphene_django import DjangoObjectType\n\nfrom app import models\n\n\n\nclass TagType(DjangoObjectType):\n class Meta:\n model = models.Tag\n interfaces = (gra... | python | chosen |
[
{
"from": "system",
"value": "Use the right float names for type shortcuts\n"
},
{
"from": "human",
"value": "from basetypes import *\nfrom exttypes import *\nfrom closuretypes import *\nfrom ssatypes import *\nfrom templatetypes import *\nfrom typemapper import *\n\n__all__ = minitypes.__all__ ... | python | chosen |
[
{
"from": "system",
"value": "Fix unused import flag by codacy\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n\"\"\"\nThis module is used to manage optional dependencies.\n\nExample usage::\n\n from birdy.dependencies import ipywidgets as widgets\n\"\"\"\n\nimport warnings\nfro... | python | chosen |
[
{
"from": "system",
"value": "Use named urls for get_post_url().\n\nThe helper should not assume knowledge of the post url structure.\n"
},
{
"from": "human",
"value": "from models import Post\n\ndef get_post_url(post):\n post_year = str(post.publication_date.year)\n post_month = '%02d' % ... | python | chosen |
[
{
"from": "system",
"value": "Add unit test for bookstore\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\n# -*- coding: utf-8 -*-\n'''Bookstore\n\nStores IPython notebooks automagically onto OpenStack clouds through Swift.\n'''\n\n__title__ = 'bookstore'\n__version__ = '1.0.0'\n__bui... | python | chosen |
[
{
"from": "system",
"value": "Use a random number instead of uuid for temp database name.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2007-2009 Christopher Lenz\n# All rights reserved.\n#\n# This software is licensed as described in the file COPYING, which\n# y... | python | chosen |
[
{
"from": "system",
"value": "Move mask gathering to it's own function\n"
},
{
"from": "human",
"value": "from PIL import Image\nimport glob\n\n\ndef _get_rectangle_masks():\n TRAIN_MASKS = './data/train/*_mask.tif'\n rectangle_masks = []\n for file_name in glob.glob(TRAIN_MASKS):\n ... | python | chosen |
[
{
"from": "system",
"value": "Set correct version in package\n"
},
{
"from": "human",
"value": "\"\"\"Python module to manipulate Kindle clippings files.\"\"\"\n\n__version__ = '0.3.0'\n"
},
{
"from": "gpt",
"value": "\"\"\"Python module to manipulate Kindle clippings files.\"\"\"\n\... | python | chosen |
[
{
"from": "system",
"value": "Add helper to find representative centroid of a subset of data, add helper to generate initial k centroid intelligently\n"
},
{
"from": "human",
"value": "#returns the distance between two data points\ndef distance(X, Y):\n d = 0\n for row in range(len(X)):\n f... | python | chosen |
[
{
"from": "system",
"value": "Correct repo field name in serializer\n"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom .models import Challenge, Role\nfrom core.serializers import UserSerializer\n#from comments.serializers import HeadCommentSerializer, TailCommentS... | python | chosen |
[
{
"from": "system",
"value": "Clean up and change cov time\n"
},
{
"from": "human",
"value": "import mne\nimport sys\n\nfrom mne import compute_covariance\n\nimport matplotlib\nmatplotlib.use('Agg')\nimport matplotlib.pyplot as plt\n\nfrom my_settings import *\n\nreject = dict(grad=4000e-13, # ... | python | chosen |
[
{
"from": "system",
"value": "Send to DQ not admin\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\r\n\r\nfrom reporter.reports import Report, Schedule\r\nfrom reporter import get_case_link, RECIPIENT_BRICCS_ADMIN\r\n\r\n\r\nclass BriccsCivcrmBlankStudyId(Report):\r\n def __init__(s... | python | chosen |
[
{
"from": "system",
"value": "Test that .SES files are tagged as Sesans\n"
},
{
"from": "human",
"value": "\"\"\"\n Unit tests for the SESANS .ses reader\n\"\"\"\n\nimport unittest\nfrom sas.sascalc.dataloader.loader import Loader\n\nimport os.path\n\nclass sesans_reader(unittest.TestCase):\n... | python | chosen |
[
{
"from": "human",
"value": "Add model to store log data\n"
},
{
"from": "gpt",
"value": "from django.db import models\n\n\nclass DataPoint(models.Model):\n name = models.CharField(max_length=200)\n exact_name = models.CharField(max_length=600, null=True, blank=True)\n\n options = model... | python | chosen |
[
{
"from": "system",
"value": "Add pmid to url convertion\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom __future__ import unicode_literals\n\nfrom akatsuki.exporter import export_html\nfrom akatsuki.parser import load_bibtex_file\nfrom akatsuki.utils im... | python | chosen |
[
{
"from": "system",
"value": "Add named tables to the examples\n"
},
{
"from": "human",
"value": "# -----------------------------------------------------------------------------\n# Created: 04.03.2014\n# Copyright: (c) Josua Schmid 2014\n# Licence: AGPLv3\n#\n# Sample script for parsin... | python | chosen |
[
{
"from": "system",
"value": "Add created field to DataPoint model\n"
},
{
"from": "human",
"value": "import numpy\nimport ast\n\nfrom django.db import models\n\n\nclass DataPoint(models.Model):\n name = models.CharField(max_length=600)\n exact_name = models.CharField(max_length=1000, null... | python | chosen |
[
{
"from": "system",
"value": "Prepare to fix a new version.\n"
},
{
"from": "human",
"value": "__version__ = (0, 3, 'dev')\n\n\nfrom memory import *\nfrom models import *\nfrom columns import *\nfrom options import *\n"
},
{
"from": "gpt",
"value": "__version__ = (0, 2, 1)\n\n\nfrom ... | python | chosen |
[
{
"from": "system",
"value": "Cut fbcode_builder dep for thrift on krb5\n\nSummary: [Thrift] Cut `fbcode_builder` dep for `thrift` on `krb5`. In the past, Thrift depended on Kerberos and the `krb5` implementation for its transport-layer security. However, Thrift has since migrated fully to Transport Layer S... | python | chosen |
[
{
"from": "system",
"value": "Fix bytes problem on python 3.\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\nimport subprocess\n\nclass ShellM... | python | chosen |
[
{
"from": "system",
"value": "Remove change dir commands and now it sends directly.\n"
},
{
"from": "human",
"value": "from __future__ import print_function\nimport sys\nimport os\nfrom sh import cd, hg\n\n\ndef _get_subdirectories(current_dir):\n return [directory for directory in os.listdir... | python | chosen |
[
{
"from": "system",
"value": "Remove blank line at end of file.\n"
},
{
"from": "human",
"value": "class Formatter(object):\n name = None\n description = None\n\n def __init__(self, stream, config):\n self.stream = stream\n self.config = config\n\n def uri(self, uri):\n... | python | chosen |
[
{
"from": "system",
"value": "Fix a bug when you try to add a geo tag to an object that does not have already one"
},
{
"from": "human",
"value": "from django.http import HttpResponseRedirect\nfrom django.shortcuts import render_to_response\nfrom django.template import RequestContext\nfrom djang... | python | chosen |
[
{
"from": "system",
"value": "Add model to keep track of users' estimates.\n"
},
{
"from": "human",
"value": "from .. import db\n\nclass Question(db.Model):\n\tid = db.Column(db.Integer, primary_key=True)\n\ttext = db.Column(db.String(240), unique=True, index=True)\n\tanswer = db.Column(db.Numer... | python | chosen |
[
{
"from": "system",
"value": "Put the middleware near the top (again).\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nfrom aldryn_client import forms\n\nclass Form(forms.BaseForm):\n\n def to_settings(self, cleaned_data, settings_dict):\n settings_dict['MIDDLEWARE_CLASSE... | python | chosen |
[
{
"from": "system",
"value": "Make sure we're checking ints to ints.\n"
},
{
"from": "human",
"value": "import stomp\nimport urlparse\nimport json\n\nurlparse.uses_netloc.append('tcp')\n\nclass ZKillboardStompListener(object):\n\n def __init__(self, bot):\n self.bot = bot\n self... | python | chosen |
[
{
"from": "system",
"value": "Add default_sort param to get_now_sorting_by\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\n\ndef get_sort_by_choices(filter):\n return [(choice[0], choice[1].lower()) for choice in\n filter.filters['sort_by'].field.choic... | python | chosen |
[
{
"from": "system",
"value": "Update exporter to work with Anki ≥ 2.1.36\n\n`exporters` now takes an argument.\n\nSee e3b4802f47395b9c1a75ff89505410e91f34477e\n\nIntroduced after 2.1.35 but before 2.1.36. (Testing explicitly shows\nthat this change is needed for 2.1.36 and 2.1.37, but breaks 2.1.35.)\n\nFi... | python | chosen |
[
{
"from": "system",
"value": "Test for Envoy logs format\n\nSigned-off-by: Alvaro Saurin <5b2d0c210c4a9fd6aeaf2eaedf8273be993c90c2@datawire.io>\n"
},
{
"from": "human",
"value": "import pytest, re\n\nfrom kat.utils import ShellCommand\nfrom abstract_tests import AmbassadorTest, ServiceType, HTTP... | python | chosen |
[
{
"from": "system",
"value": "Use request.data in DRF >= 3\n"
},
{
"from": "human",
"value": "from distutils.version import StrictVersion\n\nimport rest_framework\nfrom rest_framework import serializers\nfrom django.forms import widgets\n\n\nif StrictVersion(rest_framework.VERSION) < StrictVersi... | python | chosen |
[
{
"from": "system",
"value": "Disable caching so CSRF tokens are not cached.\n"
},
{
"from": "human",
"value": "from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition\nfrom form_designer.views import process_form\nfrom form_designer import settings\n\nfrom cms.... | python | chosen |
[
{
"from": "system",
"value": "Use INFOSYSTEM enviroment for Queue\n"
},
{
"from": "human",
"value": "import flask\nfrom pika import BlockingConnection, PlainCredentials, ConnectionParameters\n\n\nclass RabbitMQ:\n\n def __init__(self):\n self.url = flask.current_app.config['ORMENU_QUEU... | python | chosen |
[
{
"from": "system",
"value": "Enable HTML source editing in the content editor\n"
},
{
"from": "human",
"value": "from wagtail.contrib.modeladmin.options import \\\n ModelAdmin, ModelAdminGroup, modeladmin_register\nfrom .models import Indicator, FooterLinkSection\n\n\nclass IndicatorAdmin(Mo... | python | chosen |
[
{
"from": "system",
"value": "Fix mis-naming from pylint cleanup\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nModule for running arbitrary tests with a __virtual__ function\n'''\nfrom __future__ import absolute_import\n\n\ndef __virtual__():\n return False\n\n\ndef test():... | python | chosen |
[
{
"from": "system",
"value": "Split system import and project import\n"
},
{
"from": "human",
"value": "from chainer.training import extension\nimport time\n\n\ndef observe_value(key, target_func):\n \"\"\"Returns a trainer extension to continuously record a value.\n\n Args:\n key (... | python | chosen |
[
{
"from": "system",
"value": "Replace scisoftpy import with numjy\n"
},
{
"from": "human",
"value": "import os\n\ntry:\n range_ = xrange\nexcept NameError:\n # For Python3\n range_ = range\n\n\nif os.name == 'java':\n import scisoftpy as numpy\nelse:\n import numpy\n\nnp = numpy\n... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.