conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "style: Fix the misspell in docstring\n\nDatatime -> Datetime\n"
},
{
"from": "human",
"value": "\"\"\"Utility functions and classes for track backends\"\"\"\n\nimport json\nfrom datetime import datetime, date\n\nfrom pytz import UTC\n\n\nclass DateTimeJSONEncoder(js... | python | chosen |
[
{
"from": "system",
"value": "Test can't give group non-exsitent permission\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom django.contrib.auth.models import Permission, Group, ContentType\n\nfrom contacts.group_permissions import GroupPermissions\n\n\n@pytest.mark.django_db\ndef test_a... | python | chosen |
[
{
"from": "system",
"value": "Set servicejid setting on register\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n#from twisted.words.xish import domish\n\nfrom base import *\nimport random\nimport time\nimport bnw_core.bnw_objects as objs\n\ndef _(s,user):\n return s\n\nfrom uuid ... | python | chosen |
[
{
"from": "system",
"value": "Fix up logging on local.\n"
},
{
"from": "human",
"value": "from logging import LOGGING\n\nDEBUG = True\n\n# Don't log to sentry on local.\nLOGGING['root']['handlers'] = ['console']\nLOGGING['loggers']['django.request'] = {\n 'level': 'ERROR',\n 'handlers': ['... | python | chosen |
[
{
"from": "system",
"value": "Make numpy test clearer and ensure unstub\n"
},
{
"from": "human",
"value": "import mockito\nfrom mockito import when, patch\n\nimport numpy as np\nfrom . import module\n\n\ndef xcompare(a, b):\n if isinstance(a, mockito.matchers.Matcher):\n return a.match... | python | chosen |
[
{
"from": "system",
"value": "Add support for multiple datasets\n"
},
{
"from": "human",
"value": "import sys\nimport click\nimport json\nimport csv\nfrom rdflib import Graph, Namespace, URIRef\n\n\ndef observe_dataset(dataset, query, prefixes):\n g = Graph()\n if prefixes:\n prefix... | python | chosen |
[
{
"from": "system",
"value": "Prepend simplejson import with 'module' name\n"
},
{
"from": "human",
"value": "import sublime\nimport sublime_plugin\nimport simplejson as json\nfrom simplejson import OrderedDict\nimport decimal\n\ns = sublime.load_settings(\"Pretty JSON.sublime-settings\")\n\n\nc... | python | chosen |
[
{
"from": "system",
"value": "Fix cache key set, on core cache\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom django.db import models\nfrom django.core.cache import cache\nfrom django.conf import settings\n\n\nclass CacheManager(models.Manager):\n def ... | python | chosen |
[
{
"from": "system",
"value": "Remove pandas sample utils, these are built into pandas\n"
},
{
"from": "human",
"value": "import math\n\nimport numpy as np\n\n\ndef remove_single_value_columns(df):\n drop_ix = df.apply(pd.Series.value_counts,\n normalize=True,\n ... | python | chosen |
[
{
"from": "system",
"value": "Add a never changing __location__ attribute to cumulusci to get the root\nof the cumulusci codebase\n"
},
{
"from": "human",
"value": "__import__('pkg_resources').declare_namespace('cumulusci')\n__version__ = '2.0.0-beta56'\n"
},
{
"from": "gpt",
"value"... | python | chosen |
[
{
"from": "system",
"value": "Fix exception handling in HTTPNotifier\n"
},
{
"from": "human",
"value": "import logging\nimport requests\n\nfrom .base import Notifier\n\nlog = logging.getLogger(__name__)\n\n\nclass HTTPNotifier(Notifier):\n ''' A Notifier that sends http post request to a give... | python | chosen |
[
{
"from": "system",
"value": "Use double instead of single quotes for doc string\n"
},
{
"from": "human",
"value": "import warnings\nimport functools\n\n\n__all__ = ['deprecated']\n\n\nclass deprecated(object):\n '''Decorator to mark deprecated functions with warning.\n\n Adapted from <htt... | python | chosen |
[
{
"from": "system",
"value": "Test Vector2.isclose with invalid values\n"
},
{
"from": "human",
"value": "from ppb_vector import Vector2\nfrom utils import vectors\nfrom hypothesis import assume, given, note, example\nfrom hypothesis.strategies import floats\n\n\n@given(x=vectors(), abs_tol=floa... | python | chosen |
[
{
"from": "system",
"value": "Rename version field in Choice to question_id\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom rest_framework import serializers\n\nclass Question(models.Model):\n version = models.CharField(primary_key=True, max_length=8)\n text = models.... | python | chosen |
[
{
"from": "system",
"value": "Clean up the DNS test\n"
},
{
"from": "human",
"value": "from dns import resolver\nimport gevent\nimport os\n\ndef lookup(hostname, ns):\n res = resolver.Resolver(configure=False)\n res.nameservers = [ns]\n answer = res.query(hostname)\n \n ret = [] ... | python | chosen |
[
{
"from": "system",
"value": "Use relative imports, Python 2.6 style\n"
},
{
"from": "human",
"value": "__author__ = 'Daniel Greenfeld, Chris Adams'\n\nVERSION = (0, 5, 1)\n\ndef get_version():\n version = '%s.%s' % (VERSION[0], VERSION[1])\n if VERSION[2]:\n version = '%s.%s' % (ve... | python | chosen |
[
{
"from": "system",
"value": "Add Element admin view in admin url\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom .views import AdminHandler, CubeHandler, ConnectionHandler\n\nINCLUDE_URLS = [\n (r\"/admin\", AdminHandler),\n (r\"/admin/connection\",... | python | chosen |
[
{
"from": "system",
"value": "Quit popup, NPSAppManaged and TERM\n\nMain class (App) now extends NPSAppManaged, and forms are added in\nkosher way. Quit popup is also implemented and available upon\npressing `q` key (`Q` key too!).\n\nAdditionally, application sets TERM env variable to proper value\n(`xterm... | python | chosen |
[
{
"from": "system",
"value": "TST: Fix pims warning test under Py3\n"
},
{
"from": "human",
"value": "from __future__ import (absolute_import, division, print_function,\n unicode_literals)\nimport six\nimport os\nimport unittest\nimport warnings\n\nimport trackpy\nimport t... | python | chosen |
[
{
"from": "system",
"value": "[IMP] Remove unneeded dependency on Inventory\n"
},
{
"from": "human",
"value": "# Copyright (C) 2019 - TODAY, Open Source Integrators\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n\n{\n 'name': 'Product ISP',\n 'version': '12.0.1.0.0',\n ... | python | chosen |
[
{
"from": "system",
"value": "Change bases of exception classes extending SpamListsError and ValueError\n\nThis commit removes SpamListsError and ValueError as direct base classes\nof other exception classes (except SpamListsValueError), and replaces\nthem with SpamListsValueError.\n"
},
{
"from": "... | python | chosen |
[
{
"from": "system",
"value": "Bump version: 0.0.1 -> 0.0.2\n\n[ci skip]\n"
},
{
"from": "human",
"value": "from conans import ConanFile\nfrom conans.tools import download, unzip\nimport os\n\nVERSION = \"0.0.1\"\n\n\nclass ToolingCMakeUtilConan(ConanFile):\n name = \"tooling-find-pkg-util\"\n... | python | chosen |
[
{
"from": "system",
"value": "Add bullet hit function to destroy self.\n"
},
{
"from": "human",
"value": "from tkinter import Label\nimport threading\n\n\nclass Bullet(Label):\n def __init__(self, x, y, space):\n self.space = space\n self.bullet_timer = 0.01\n self.bullet... | python | chosen |
[
{
"from": "system",
"value": "Handle touching files that don't yet exist\n"
},
{
"from": "human",
"value": "\nimport os.path\nimport errno\n\n\ndef touch(path, times=None):\n \"\"\"Mimics the behavior of the `touch` UNIX command line tool, to create\n empty files.\n \"\"\"\n\n with o... | python | chosen |
[
{
"from": "system",
"value": "Use colorama to print colors and print a plugin's short_description after running\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n# -*- coding: utf8 -*-\n\"\"\"\nUsage:\nstringinfo STRING...\n\nOptions:\nSTRING One or more strings for which you w... | python | chosen |
[
{
"from": "system",
"value": "Check if the input is negative\n\nAs the comments mention, the code would work only for unsigned integers.\nIf a negative integer is provided as input, then the code runs into an\ninfinite loop. To avoid this, we are checking if the input is negative.\nIf yes, then return contr... | python | chosen |
[
{
"from": "system",
"value": "Add back import of cli.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n# main: loader of all the command entry points.\n\nfrom pkg_resources import iter_entry_points\n\n\nfor entry_point in iter_entry_points('rasterio.rio_commands'):\n entry_point.load... | python | chosen |
[
{
"from": "system",
"value": "Add documentation and touch up formatting of attr_string util method\n"
},
{
"from": "human",
"value": "\"\"\"\n@author: Geir Sporsheim\n@license: see LICENCE for details\n\"\"\"\n\ndef attr_string(filterKeys=(), filterValues=(), **kwargs):\n return ', '.join([st... | python | chosen |
[
{
"from": "system",
"value": "Disable strict host checking for ssh\n"
},
{
"from": "human",
"value": "from storm.parsers.ssh_config_parser import ConfigParser as StormParser\nfrom os.path import expanduser\n\ndef add_host(name, user, hostname, key_file):\n sconfig = StormParser(expanduser(\"~... | python | chosen |
[
{
"from": "system",
"value": "Add datetime field to Event model in sensor.core\n"
},
{
"from": "human",
"value": "# This Source Code Form is subject to the terms of the Mozilla Public\n# License, v. 2.0. If a copy of the MPL was not distributed with this\n# file, You can obtain one at http://... | python | chosen |
[
{
"from": "system",
"value": "Raise ValueError when no path and DEBUG\n\nFails silently when DEBUG is False\n"
},
{
"from": "human",
"value": "from django import template\nfrom django.urls import reverse\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef image(img, **kwargs):\n ... | python | chosen |
[
{
"from": "system",
"value": "Update comments for loginput tests\n\nSigned-off-by: Brandon Myers <9cda508be11a1ae7ceef912b85c196946f0ec5f3@mozilla.com>\n"
},
{
"from": "human",
"value": "from loginput_test_suite import LoginputTestSuite\n\n\nclass TestTestRoute(LoginputTestSuite):\n routes = ... | python | chosen |
[
{
"from": "system",
"value": "Add minor fixes to movie lister miniapp\n"
},
{
"from": "human",
"value": "\"\"\"Movies package.\n\nTop-level package of movies library. This package contains IoC container of\nmovies module component providers - ``MoviesModule``. It is recommended to use\nmovies li... | python | chosen |
[
{
"from": "system",
"value": "Update example to refactored code\n"
},
{
"from": "human",
"value": "import logging\nfrom twisted.internet import reactor\n\nfrom flist.core import FList_Account\n\ndef log_status(data):\n logging.debug(\"{character} is {status}: {statusmsg}\".format(**data))\n\n... | python | chosen |
[
{
"from": "system",
"value": "Include plot title to plots\n"
},
{
"from": "human",
"value": "from flask_restplus import Namespace, Resource, fields, abort\n\nimport cea.config\nimport cea.plots.cache\n\napi = Namespace('Dashboard', description='Dashboard plots')\n\n\nLAYOUTS = ['row', 'grid', 'm... | python | chosen |
[
{
"from": "system",
"value": "Add tests for valid email converter\n"
},
{
"from": "human",
"value": "# encoding: utf-8\nimport nose\nfrom datetime import datetime, timedelta\nfrom ckanext.requestdata import helpers as h\nimport ckan.plugins as p\nfrom ckan.tests import helpers, factories\nfrom c... | python | chosen |
[
{
"from": "system",
"value": "Fix type in contrib.sites.migrations for Django 2.x compatibility\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nimport django.contrib.sites.models\nfrom django.db import migrations, models\n\n\nclass Migration... | python | chosen |
[
{
"from": "system",
"value": "Fix regression: 'import pytest' error when starting adhocracy\n"
},
{
"from": "human",
"value": "\"\"\" Catalog utilities.\"\"\"\nfrom substanced import catalog\nfrom substanced.interfaces import IIndexingActionProcessor\nfrom zope.interface import Interface\n\n\n@c... | python | chosen |
[
{
"from": "system",
"value": "Add timing message to example\n"
},
{
"from": "human",
"value": "from pmst.source import DirectedPointSource\nfrom pmst.microscope import Microscope\nfrom pmst.detector import Detector\nfrom pmst.geometry import Point\nimport numpy as np\n\ns = DirectedPointSource(P... | python | chosen |
[
{
"from": "system",
"value": "Allow package to be imported\n"
},
{
"from": "human",
"value": "# allow `soulmate_finder` to be imported\n\n# FIXME: This is bad\n# FIXME: WHY IS THIS CAUSING A RUNTIMEWARNING???\n# from .__main__ import *\n"
},
{
"from": "gpt",
"value": "from .core impo... | python | chosen |
[
{
"from": "system",
"value": "Fix test name, cover speed getter\n\nSigned-off-by: pkulev <661f9993ccc93424ad20871d2ea98bc2860e5968@gmail.com>\n"
},
{
"from": "human",
"value": "\"\"\"Test xoinvader.level module.\"\"\"\n\nfrom xoinvader.level import Level\n\n\n# pylint: disable=invalid-name,prote... | python | chosen |
[
{
"from": "system",
"value": "Fix 'not import from sys'\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n###################################################################\n#\n# Copyright (c) 2011 Canonical Ltd.\n# Copyright (c) 2013 Miing.org <samuel.miing@gmail.com>\n# \n# This softw... | python | chosen |
[
{
"from": "system",
"value": "Fix get next new moon\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport datetime\nimport random\n\nimport ephem\n\nfrom nodes import Node\n\n\nclass Random(Node):\n char = \"H\"\n args = 1\n results = 1\n \n def random_choice(self, in... | python | chosen |
[
{
"from": "system",
"value": "[fix] Rename property setter for fetch_from\n"
},
{
"from": "human",
"value": "import frappe\n\ndef execute():\n\tfrappe.reload_doc(\"core\", \"doctype\", \"docfield\", force=True)\n\tfrappe.reload_doc(\"custom\", \"doctype\", \"custom_field\", force=True)\n\tfrappe... | python | chosen |
[
{
"from": "system",
"value": "Update tests to refelct the removal of the users list view.\n"
},
{
"from": "human",
"value": "from nose.tools import eq_\n\nfrom django.contrib.auth.models import User\nfrom django.test import TestCase\n\nfrom django_nose.tools import assert_redirects\nfrom us_igni... | python | chosen |
[
{
"from": "system",
"value": "Set icon before calling show() to avoid warning.\n"
},
{
"from": "human",
"value": "import trayjenkins\nfrom PySide import QtGui\nfrom pyjenkins.Event import Event\nfrom trayjenkins.status.interfaces import IView\n\nclass TrayIconView(IView):\n\n def __init__(sel... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong import from UploadHandler\n"
},
{
"from": "human",
"value": "import os\n\nfrom data.Track.UploadHandler import UploadHandler\n\nfrom src.data.Track.Tracks import YoutubeTrack\n\n\nclass YoutubeUploadHandler(UploadHandler):\n\n def __init__(self, working... | python | chosen |
[
{
"from": "system",
"value": "Add github to the accounts package.\n"
},
{
"from": "human",
"value": "\"\"\"Import and register all account types.\"\"\"\n\nfrom abc import ABC, abstractmethod\n\n\nclass Account(ABC):\n\n @abstractmethod\n def __init__(self, *breadcrumbs):\n \"\"\"\n ... | python | chosen |
[
{
"from": "system",
"value": "Implement fallback mode to make the image unsable without Galaxy\n"
},
{
"from": "human",
"value": "# See http://ipython.org/ipython-doc/1/interactive/public_server.html for more information.\n# Configuration file for ipython-notebook.\nc = get_config()\nc.NotebookA... | python | chosen |
[
{
"from": "system",
"value": "Remove pylearn1 dependency from packaged_dependencies/theano_linear\n"
},
{
"from": "human",
"value": "\n_ndarray_status_fmt='%(msg)s shape=%(shape)s min=%(min)f max=%(max)f'\n\n\ndef ndarray_status(x, fmt=_ndarray_status_fmt, msg=\"\", **kwargs):\n kwargs.update... | python | chosen |
[
{
"from": "system",
"value": "Change how we get course ids to avoid memory issues\n"
},
{
"from": "human",
"value": "\"\"\"\nExport course metadata for all courses\n\"\"\"\n\nfrom django.core.management.base import BaseCommand\n\nfrom xmodule.modulestore.django import modulestore\n\nfrom cms.dja... | python | chosen |
[
{
"from": "system",
"value": "Change default super user password.\n"
},
{
"from": "human",
"value": "default_admin_user = \"richard\"\ndefault_admin_password = \"richard555\"\n"
},
{
"from": "gpt",
"value": "default_admin_user = \"richard\"\ndefault_admin_password = \"richard666\"\n"... | python | chosen |
[
{
"from": "system",
"value": "Use AWS SMTP server in cut release script.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\nfrom email.mime.text import MIMEText\nimport smtplib\nimport sys\n\ndef send(recipient, sender, subject, body):\n message = MIMEText(body, _charset='UTF-8')\n ... | python | chosen |
[
{
"from": "system",
"value": "Allow to filter expert requests by state [WAL-1041]\n"
},
{
"from": "human",
"value": "import django_filters\n\nfrom nodeconductor.core import filters as core_filters\n\nfrom . import models\n\n\nclass ExpertProviderFilter(django_filters.FilterSet):\n customer = ... | python | chosen |
[
{
"from": "system",
"value": "Use argparse to handle arguments\n\n* Use argparse to handle commandline arguments.\n* Create initial layout of how the code might end up - lots of the code\n is currently commented out.\n"
},
{
"from": "human",
"value": "# Run with something like\n#\n# env GN2_P... | python | chosen |
[
{
"from": "system",
"value": "Add placeholder to first_name and last_name fields in signup form\n"
},
{
"from": "human",
"value": "from django import forms\n\n\nclass SignupForm(forms.Form):\n field_order = ['username', 'first_name', 'last_name', 'email', 'password', 'password2']\n\n first... | python | chosen |
[
{
"from": "system",
"value": "Make discrete functions for each force field\n"
},
{
"from": "human",
"value": "import os\nimport glob\nfrom pkg_resources import resource_filename\n\nfrom foyer import Forcefield\n\n\ndef get_ff_path():\n return [resource_filename('foyer', 'forcefields')]\n\n\nd... | python | chosen |
[
{
"from": "system",
"value": "Make external citations Python3 compatible\n"
},
{
"from": "human",
"value": "from django.template import loader\nimport utils\n\nfrom regulations.generator.layers.base import SearchReplaceLayer\n\n\nclass ExternalCitationLayer(SearchReplaceLayer):\n shorthand = ... | python | chosen |
[
{
"from": "system",
"value": "[AC-8296] Change field type for answer_text\n"
},
{
"from": "human",
"value": "# MIT License\n# Copyright (c) 2017 MassChallenge, Inc.\n\nfrom __future__ import unicode_literals\n\nimport swapper\nfrom django.db import models\nfrom django.utils.encoding import pytho... | python | chosen |
[
{
"from": "system",
"value": "Fix an incorrect postcode for Reading\n"
},
{
"from": "human",
"value": "from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter\n\n\nclass Command(BaseXpressDemocracyClubCsvImporter):\n council_id = \"RDG\"\n addresses_name = (\n ... | python | chosen |
[
{
"from": "system",
"value": "Add redirect to /admin/ on Admin app w/ empty URL\n"
},
{
"from": "human",
"value": "from django.conf.urls import include, url, patterns\nfrom django.contrib import admin\nfrom settings import ADMIN_BASE\n\nfrom . import views\n\nbase_pattern = '^{}'.format(ADMIN_BA... | python | chosen |
[
{
"from": "system",
"value": "Remove minor errors in onion\n"
},
{
"from": "human",
"value": "import subprocess\nimport sys\nimport os\nimport setup_util \n\ndef start(args, logfile, errfile):\n setup_util.replace_text(\"onion/hello.c\", \"mysql_real_connect\\(data.db\\[i\\], \\\".*\\\",\", \"m... | python | chosen |
[
{
"from": "system",
"value": "Fix UTF-8 Bug In summarize Function\n"
},
{
"from": "human",
"value": "from django.utils.safestring import mark_safe\nimport markdown\n\n\n# Convert a markdown string into HTML5, and prevent Django from escaping it\ndef mdToHTML(value):\n\treturn mark_safe(markdown.... | python | chosen |
[
{
"from": "system",
"value": "Return suffix array indices from burrows wheeler\n"
},
{
"from": "human",
"value": "\ndef burrows_wheeler(text):\n \"\"\"Returns the burrows wheeler transform of <text>.\n\n The text is assumed to not contain the character $\"\"\"\n\n text += \"$\"\n all... | python | chosen |
[
{
"from": "system",
"value": "Tag commit for v0.0.28-master generated by gitmake.py\n"
},
{
"from": "human",
"value": "major = 0\nminor=0\npatch=27\nbranch=\"master\"\ntimestamp=1376610643.76"
},
{
"from": "gpt",
"value": "major = 0\nminor=0\npatch=28\nbranch=\"master\"\ntimestamp=13... | python | chosen |
[
{
"from": "system",
"value": "Implement ModificationOperator and ModificationCondition classes\n\n"
},
{
"from": "human",
"value": "# coding: utf8\n\nfrom core.ParsingEntities import Entity\n\n\nclass ModificationEntity(Entity):\n def __add__(self, other):\n if isinstance(self, Modific... | python | chosen |
[
{
"from": "system",
"value": "Increment version number ahead of release."
},
{
"from": "human",
"value": "\"\"\"Main initialization for the WeGovNow extension.\"\"\"\n\nVERSION = (3, 1, 2)\n__version__ = '.'.join(map(str, VERSION))\n\n\ntry:\n from geokey.extensions.base import register\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Use startswith/endswith instead of indices for readability.\n"
},
{
"from": "human",
"value": "def url_path_join(url, path_part):\n \"\"\"Join a path part to the end of a URL adding/removing slashes as necessary.\"\"\"\n result = url + '/' if url[-1] != '/' el... | python | chosen |
[
{
"from": "system",
"value": "tests/equality: Add another (generated) negative example\n"
},
{
"from": "human",
"value": "from hypothesis import assume, given\nfrom ppb_vector import Vector2\nfrom utils import vectors\n\n\n@given(x=vectors())\ndef test_equal_self(x: Vector2):\n assert x == x\n\... | python | chosen |
[
{
"from": "system",
"value": "Add weekend close and open times\n"
},
{
"from": "human",
"value": "import pytz\nfrom datetime import time\nfrom zipline.utils.calendars import TradingCalendar\n\nclass ForexCalendar(TradingCalendar):\n @property\n def name(self):\n return \"forex\"\n\n... | python | chosen |
[
{
"from": "system",
"value": "Make suite-sparse use spack compilers.\n"
},
{
"from": "human",
"value": "from spack import *\n\n\nclass SuiteSparse(Package):\n \"\"\"\n SuiteSparse is a suite of sparse matrix algorithms\n \"\"\"\n homepage = 'http://faculty.cse.tamu.edu/davis/suitespa... | python | chosen |
[
{
"from": "system",
"value": "Exclude fields from CommentForm that will be automatically inserted\n"
},
{
"from": "human",
"value": "from .models import BlogPost, Comment\nfrom django.forms import ModelForm\n\nclass BlogPostForm(ModelForm):\n class Meta:\n model = BlogPost\n exc... | python | chosen |
[
{
"from": "system",
"value": "Improve and Refactor the fibonnaciSeries.py (Recursion)\n"
},
{
"from": "human",
"value": "# Fibonacci Sequence Using Recursion\n\ndef recur_fibo(n):\n if n <= 1:\n return n\n else:\n return(recur_fibo(n-1) + recur_fibo(n-2))\n \nlimit = int(input... | python | chosen |
[
{
"from": "system",
"value": "Fix flag delimiter support from 30ec188.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n#coding=utf8\n\n\"\"\"\nThis module contains functions used by a Dehacked table entry to filter certain values when reading or writing\nthem.\n\"\"\"\n\nimport math\ni... | python | chosen |
[
{
"from": "system",
"value": "Add test for non-GET requests\n\n* Check that we get a 403 result.\n"
},
{
"from": "human",
"value": "from os import environ\nfrom unittest import TestCase\n\nenviron['DJANGO_SETTINGS_MODULE'] = 'test_settings'\nfrom incuna_auth.middleware import LoginRequiredMiddle... | python | chosen |
[
{
"from": "system",
"value": "Add description of Parameters section in docstring\n"
},
{
"from": "human",
"value": "import csv\n\nfrom pygraphc.abstraction.ClusterAbstraction import ClusterAbstraction\nfrom pygraphc.clustering.ClusterUtility import ClusterUtility\n\n\nclass AnomalyScore(object):... | python | chosen |
[
{
"from": "system",
"value": "Fix indent, PEP-8 style and remove dup import.\n"
},
{
"from": "human",
"value": "from django.views.generic import RedirectView\nfrom django.views.generic.detail import SingleObjectMixin\nfrom django.contrib.auth import login, authenticate, login\nfrom django.core.e... | python | chosen |
[
{
"from": "system",
"value": "Add period at end of plug-in description\n\nThis is consistent with other plug-in descriptions.\n\nContributes to issue CURA-1190.\n"
},
{
"from": "human",
"value": "# Copyright (c) 2015 Ultimaker B.V.\n# Uranium is released under the terms of the AGPLv3 or higher.\... | python | chosen |
[
{
"from": "system",
"value": "Fix the display name of admin profile in the admin admin\n"
},
{
"from": "human",
"value": "from django.db import models\n\n\nclass AdminProfile(models.Model):\n\n user = models.OneToOneField('osf.OSFUser', related_name='admin_profile')\n\n desk_token = models... | python | chosen |
[
{
"from": "system",
"value": "Allow index to be accumulate values with same key\n"
},
{
"from": "human",
"value": "import json\nfrom pkg_resources import resource_filename\n\n\n_registry = {}\n\n\ndef has(name):\n return name in _registry\n\n\ndef get(name):\n if not has(name):\n wi... | python | chosen |
[
{
"from": "system",
"value": "Fix bug in counting words\n\nBefore, this broke with 1-word documents.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Too much yelling.\n\n---\nlayout: post\nsource: ???\nsource_url: ???\ntitle: yelling\ndate: 2014-06-10 12:31:1... | python | chosen |
[
{
"from": "system",
"value": "Update watts-strogatz call to match new NetworkX API\n"
},
{
"from": "human",
"value": "\"\"\"Top-level init file for brainx package.\n\"\"\"\n\ndef patch_nx():\n \"\"\"Temporary fix for NX's watts_strogatz routine, which has a bug in versions 1.1-1.3\n \"\"\"... | python | chosen |
[
{
"from": "system",
"value": "Add catch for undefined opcodes\n"
},
{
"from": "human",
"value": "import MOS6502\nimport instructions\n\ndef disasm(memory, maxLines=0, address=-1):\n index = 0\n lines = []\n\n while index < len(memory):\n currInst = instructions.instructions[memor... | python | chosen |
[
{
"from": "system",
"value": "Add forgotten piece of eventlet executor\n\n"
},
{
"from": "human",
"value": "# Copyright 2013 Red Hat, Inc.\n# Copyright 2013 New Dream Network, LLC (DreamHost)\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this fi... | python | chosen |
[
{
"from": "system",
"value": "Make Message.__del__ immune to teardown errors\n"
},
{
"from": "human",
"value": "\nimport io\n\nimport eccodes\n\nclass Message:\n def __init__(self, handle):\n self.handle = handle\n\n def __del__(self):\n eccodes.codes_release(self.handle)\n\n... | python | chosen |
[
{
"from": "system",
"value": "Add version and distinguish linter error from faulty witness.\n"
},
{
"from": "human",
"value": "# This file is part of BenchExec, a framework for reliable benchmarking:\n# https://github.com/sosy-lab/benchexec\n#\n# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <htt... | python | chosen |
[
{
"from": "system",
"value": "Add some more binding energy table tests.\n"
},
{
"from": "human",
"value": "# unit tests for Binding Energy database taken from AME 2016.\n\nimport os\n\nfrom pyreaclib.nucdata import BindingTable\n\nclass TestAME(object):\n @classmethod\n def setup_class(cls... | python | chosen |
[
{
"from": "system",
"value": "feat: Add database imports and restaurant routes\n"
},
{
"from": "human",
"value": "# Skeleton Flask Project\nfrom flask import Flask\napp = Flask(__name__) # Pass in default file name as parameter\n\n\n# Decorators for methods to execute based on route(s)\n@app.ro... | python | chosen |
[
{
"from": "system",
"value": "Add lang 'zh' to family 'wikivoyage' , update from compat\n\nChange-Id: Ic6c64f356511d1f92eefe9e813c9564786b2b5a5\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\n__version__ = '$Id$'\n\n# The new wikivoyage family that is hosted at wikimedia\n\nfrom py... | python | chosen |
[
{
"from": "system",
"value": "Add function to get the machine's local IP\n"
},
{
"from": "human",
"value": "import netifaces\n\n\ndef get_interface():\n return netifaces.gateways()['default'][netifaces.AF_INET][1]\n"
},
{
"from": "gpt",
"value": "import netifaces\n\n\ndef get_inte... | python | chosen |
[
{
"from": "system",
"value": "Update to run on port 5001\n\nFor development we will want to run multiple apps, so they should each bind to a different port number.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nfrom app import create_app\nfrom flask.ext.script import Mana... | python | chosen |
[
{
"from": "system",
"value": "Create function to test hidden files/dirs.\n\nChange-Id: I67e8d69fc85dfe58e4f127007c73f6888deff3e0\n"
},
{
"from": "human",
"value": "# Copyright (C) 2014 Linaro Ltd.\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of... | python | chosen |
[
{
"from": "system",
"value": "Add get magazine by id to magazine dao\n"
},
{
"from": "human",
"value": "from app import db\nfrom app.dao.decorators import transactional\nfrom app.models import Magazine\n\n\ndef dao_get_magazines():\n return Magazine.query.order_by(Magazine.created_at.desc()).... | python | chosen |
[
{
"from": "system",
"value": "Update stable builders to pull from 1.4 branch\n\nReview URL: https://codereview.chromium.org/295923003\n\ngit-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@271609 0039d316-1c4b-4281-b951-d872f2087c98\n"
},
{
"from": "human",
"value": "# Copyright 2013 The Chromi... | python | chosen |
[
{
"from": "system",
"value": "Add visualization of CA using Pillow\n"
},
{
"from": "human",
"value": "import random\n\nclass TotalisticCellularAutomaton:\n def __init__(self):\n self.n_cells = 200\n self.n_states = 5\n self.symbols = ' .oO0'\n self.radius = 1\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix for test (add mock for CommCareUser)\n"
},
{
"from": "human",
"value": "from datetime import date\nfrom unittest import TestCase\n\nfrom couchforms.models import XFormInstance\n\nfrom ..constants import *\nfrom ..reports import get_report, BeneficiaryPaymentRepo... | python | chosen |
[
{
"from": "system",
"value": "Fix fullname syntax to handle login with (at) signs\n"
},
{
"from": "human",
"value": "from collections import namedtuple\nimport os\nimport re\nimport shutil\nimport yaml\n\n\nCredential = namedtuple(\"Credential\", \"name login password comment\")\n\n\nclass Crede... | python | chosen |
[
{
"from": "system",
"value": "Add some documentation for weird init"
},
{
"from": "human",
"value": "from rest_framework import serializers\n\nfrom .models import Upload\n\n\nclass UploadSerializer(serializers.ModelSerializer):\n class Meta:\n model = Upload\n fields = '__all__'... | python | chosen |
[
{
"from": "system",
"value": "Fix json to sql converter.\n"
},
{
"from": "human",
"value": "import os\nimport os.path\nfrom json import loads\n\nimport click\n\nfrom vendcrawler.scripts.vendcrawlerdb import VendCrawlerDB\n\nclass JSONToSQL(object):\n\n def __init__(self, json, user, password,... | python | chosen |
[
{
"from": "system",
"value": "Remove wagtail_image from image resources\n"
},
{
"from": "human",
"value": "from django.conf import settings\nfrom django.urls import reverse\nfrom rest_framework import serializers\n\nfrom falmer.content.models import StaffMemberSnippet\nfrom falmer.matte.models i... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.