conversations listlengths 2 3 | source stringclasses 1 value | stack stringclasses 1 value |
|---|---|---|
[
{
"from": "system",
"value": "Handle encoding of the random words.\n"
},
{
"from": "human",
"value": "from random import choice\n\nfrom django.conf import settings\n\n\nwords = open(settings.WORDS_PATH, \"r\").readlines()\n\n\ndef random_words(total):\n return \" \".join([choice(words).lower(... | python | chosen |
[
{
"from": "system",
"value": "Remove reference to nonexistent migration to fix tests\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n\n dependencies = [... | python | chosen |
[
{
"from": "system",
"value": "Add support for connecting functions to Signal objects.\n\nLess elegant than the original recipe, but more functional.\n"
},
{
"from": "human",
"value": "\"\"\"\r\nAuthor: Thiago Marcos P. Santos\r\nCreated: August 28, 2008\r\n\r\nPurpose: A signal/slot implementat... | python | chosen |
[
{
"from": "system",
"value": "Fix onupdate not using current time\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n# Copyright 2016 Steven Oud. All rights reserved.\n# Use of this source code is governed by a MIT-style license that can be found\n# in the LICENSE file.\n\nfrom datetime... | python | chosen |
[
{
"from": "system",
"value": "Make sure a project is set for the project-specific validator\n"
},
{
"from": "human",
"value": "from rest_framework.serializers import ValidationError\n\n\nclass UniqueToProjectValidator:\n message = u'{model_name} with this {field_name} already exists.'\n\n ... | python | chosen |
[
{
"from": "system",
"value": "Update measured Focal Lengths for C920.\n"
},
{
"from": "human",
"value": "# Calculate the distance to an object of known size.\r\n# We need to know the perceived focal length for this to work.\r\n#\r\n# Known Focal Length values for calibrated cameras\r\n# Logite... | python | chosen |
[
{
"from": "system",
"value": "Use safe_load to avoid warning\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\nimport sys\nimport yaml\nfrom os import path\nfrom plistlib import dumps\n\n\ndef generated_comment():\n return \"This file is auto-generated from %s, do not edit it by hand... | python | chosen |
[
{
"from": "system",
"value": "Fix a typo in customize page url setup\n"
},
{
"from": "human",
"value": "from django.conf.urls.defaults import *\nfrom django.conf import settings\nfrom product_details import product_details\n\nfrom mozorg.util import page\nimport views\n\nurlpatterns = patterns('... | python | chosen |
[
{
"from": "system",
"value": "Add a DEBUG constant and the ability to more cleanly reference the version.\n"
},
{
"from": "human",
"value": "__version__ = '0.10.0'\n\nfrom rabbitpy.connection import Connection\nfrom rabbitpy.exchange import Exchange\nfrom rabbitpy.message import Message\nfrom ra... | python | chosen |
[
{
"from": "system",
"value": "Add pickle serialize and deserialize\n"
},
{
"from": "human",
"value": "import math\nimport random\n\n\ndef logistic(x):\n return 1.0 / (1 + math.exp(-x))\n\n\ndef deriv_logistic(x):\n lgst = logistic(x)\n return (1 - lgst) * lgst\n\n\ndef hyperbolic_tangen... | python | chosen |
[
{
"from": "system",
"value": "Set compatible_with=appengine on targets depended on by App Engine apps or by the App Engine runtime itself.\n\nThis CL has no immediate impact on the targets, but it has two consequences moving forward:\n- When google3 moves to Java 8, compatible_with=appengine targets will re... | python | chosen |
[
{
"from": "system",
"value": "Allow new import style for UM directory\n\nThis imports all public classes in the UM namespace rather than leaving them inside the modules in that namespace. For example, this allows directly importing UM.Logger and then using UM.Logger.log(...) to log a message.\n\nContributes... | python | chosen |
[
{
"from": "system",
"value": "Update arxiv script to prevent dup downloads\n"
},
{
"from": "human",
"value": "import sys\nimport os\nimport bs4\nimport urllib2\nimport urllib\nBASE_URL = \"http://arxiv.org\"\nHEP_URL = 'http://arxiv.org/abs/hep-th/%d'\n\n# TODO: Change prints to logs\n\n\ndef ge... | python | chosen |
[
{
"from": "system",
"value": "Fix sqlalchemy import alias in DB migration file"
},
{
"from": "human",
"value": "\"\"\"Add new Indexes for faster searching\n\nRevision ID: 3097d57f3f0b\nRevises: 4fe230f7a26e\nCreate Date: 2021-06-19 20:18:55.332165\n\n\"\"\"\n\n# revision identifiers, used by Ale... | python | chosen |
[
{
"from": "system",
"value": "Remove automatic fallback to SQLite\n\nIt's better to be explicit if there's no DATABASE_URL.\n"
},
{
"from": "human",
"value": "import os\n\n\nif os.environ.get('DATABASE_URL') is None:\n SQLALCHEMY_DATABASE_URI = 'sqlite:///meetup.db'\nelse:\n SQLALCHEMY_DAT... | python | chosen |
[
{
"from": "system",
"value": "Use Properties interface to get Manager properties.\n\nSigned-off-by: mulhern <7b51bcf507bcd7afb72bf8663752c0ddbeb517f6@redhat.com>\n"
},
{
"from": "human",
"value": "\"\"\"\nManager interface.\n\"\"\"\n\nclass Manager(object):\n \"\"\"\n Manager interface.\n ... | python | chosen |
[
{
"from": "system",
"value": "Fix missing close socket error\n"
},
{
"from": "human",
"value": "\nfrom multiprocessing import Process\nimport sys\n\n\nfrom fluxghost.http_server_base import HttpServerBase, logger\n\n\ndef fork_entry(request, client, server):\n from fluxghost.http_handler impo... | python | chosen |
[
{
"from": "system",
"value": "Add a functional test for mouse grab."
},
{
"from": "human",
"value": "\nfrom twisted.trial.unittest import TestCase\nfrom twisted.internet import reactor\n\nfrom game.functional.test_view3d import SceneMixin\nfrom game.player import Player\nfrom game.vector import ... | python | chosen |
[
{
"from": "system",
"value": "Move imports to top of file\n"
},
{
"from": "human",
"value": "class Config:\n DEBUG = False\n TESTING = False\n REDIS = {\n 'host': 'localhost',\n 'port': 6379,\n 'db': 0,\n 'password': None\n }\n REDIS_KEY_EXPIRE = 604800... | python | chosen |
[
{
"from": "system",
"value": "Add max config to globals\n"
},
{
"from": "human",
"value": "from rma.redis import *\n\nclass GlobalKeySpace:\n def __init__(self, redis):\n \"\"\"\n :param RmaRedis redis:\n :return:\n \"\"\"\n self.redis = redis\n\n def ana... | python | chosen |
[
{
"from": "system",
"value": "Order status changed to integer\n"
},
{
"from": "human",
"value": "from __future__ import unicode_literals\n\nfrom django.db import models\nfrom django.utils.encoding import python_2_unicode_compatible\n\nfrom bazaar.listings.models import Publishing, Store\n\n\n@py... | python | chosen |
[
{
"from": "system",
"value": "Add Salt specific exit code\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n'''\nClassification of Salt exit codes. These are intended to augment\nuniversal exit codes (found in Python's `os` module with the `EX_`\nprefix or in `sysexits.h`).\n'''\n\n# ... | python | chosen |
[
{
"from": "system",
"value": "Test the actual get_zone call\n"
},
{
"from": "human",
"value": "import os\nfrom unittest import TestCase\n\nfrom yoconfigurator.base import read_config\nfrom yoconfig import configure_services\n\nfrom pycloudflare.services import CloudFlareService\n\napp_dir = os.p... | python | chosen |
[
{
"from": "system",
"value": "Fix display of full user name at least on current user's settings page\n"
},
{
"from": "human",
"value": "\"\"\"\nbyceps.services.user.transfer.models\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n:Copyright: 2006-2021 Jochen Kupperschmidt\n:License: Revised BSD (see `LI... | python | chosen |
[
{
"from": "system",
"value": "Add support of s3 path\n"
},
{
"from": "human",
"value": "\"\"\"\nThis command will create and run survey jobs for each SRA run accession\nin the range from start_accession to end_accession.\n\"\"\"\n\nfrom django.core.management.base import BaseCommand\nfrom data_r... | python | chosen |
[
{
"from": "system",
"value": "Use the example to verify tiled image updates are working\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python3\n\n# This file was developed by Thomáš Iser & Thomas Müller <thomas94@gmx.net>.\n# It is published under the BSD 3-Clause License within the LICENSE f... | python | chosen |
[
{
"from": "system",
"value": "Fix default port for Redis in event stream\n"
},
{
"from": "human",
"value": "import os\n\nfrom flask import Flask\nfrom flask_sse import sse\n\napp = Flask(__name__)\nredis_host = os.environ.get(\"KV_HOST\", \"localhost\")\nredis_port = os.environ.get(\"KV_PORT\"... | python | chosen |
[
{
"from": "system",
"value": "Fix coding style for travis ci build.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Example Dropbox local settings file. Copy this file to local.py and change\nthese settings.\n\"\"\"\n# Get an app key and secret at https://www.dropbox.com/develo... | python | chosen |
[
{
"from": "human",
"value": "Add some necessary things to run the app\n"
},
{
"from": "gpt",
"value": "#!/usr/bin/env python\n# coding=utf-8\n# \n# Copyright 2015 cc98.org\n\nimport sys\nreload(sys)\nsys.setdefaultencoding(\"utf-8\")\n\nimport os.path\nimport re\nimport memcache\nimport torndb\n... | python | chosen |
[
{
"from": "system",
"value": "Remove operations in module reserved for declaring constants.\n"
},
{
"from": "human",
"value": "VIRTUALENV_DIR = \"virtual_env/\"\nVIRTUALENV_ACTIVATE = VIRTUALENV_DIR + \"bin/activate_this.py\"\nLOGS = \"logs/\"\nYAML = \"/etc/ggrc_test.yaml\"\nRESOURCES = \"resou... | python | chosen |
[
{
"from": "system",
"value": "Fix form to query UserChoices, not Packages\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.forms.models import ModelForm\nfrom installer_config.models import EnvironmentProfile, Package, TerminalPrompt\n \n\nclass EnvironmentForm(ModelForm)... | python | chosen |
[
{
"from": "human",
"value": "Add the method to prettify the time displayed.\n"
},
{
"from": "gpt",
"value": "class Filters():\n\t\"\"\"\n\tGet a datetime instance object or a int() Epoch timestamp and return a pretty \n\tstring like 'an hour ago', 'Yesterday', '3 month ago', 'just now' etc.\n\t\... | python | chosen |
[
{
"from": "system",
"value": "Add the 401 Unauthorized when no username is detected, thus no user\nis logged in. This is the most basic form of permissions, where any\nuser can log in and do anything.\n"
},
{
"from": "human",
"value": "from django.shortcuts import render\nfrom django.core import... | python | chosen |
[
{
"from": "system",
"value": "Fix a leftover \"gci\" documentation note to correctly refer to Summer of Code.\n\nThis fixes issue 1790, and thanks to Piyush Bansal for reporting the error\nand directing its fix.\n"
},
{
"from": "human",
"value": "# Copyright 2012 the Melange authors.\n#\n# Licen... | python | chosen |
[
{
"from": "system",
"value": "Check for None before indexing.\n"
},
{
"from": "human",
"value": "class UnitOrders(object):\n def __init__(self):\n self.orders = {}\n\n def giveOrders(self, unit, orders):\n if orders is not None and not isinstance(orders, list):\n o... | python | chosen |
[
{
"from": "system",
"value": "Add Tags and WorkspaceProperties to WorkSpaces::Workspace\n"
},
{
"from": "human",
"value": "# Copyright (c) 2015, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nfrom . import AWSObject\nfrom .validators import boolean\... | python | chosen |
[
{
"from": "system",
"value": "Add sleep after shutting down hppcorbaserver in ServerManager\n\nCo-authored-by: Joseph Mirabel <c794dc978753694c40f4d5fd4b8c12595a76e068@gmail.com>"
},
{
"from": "human",
"value": "# Copyright (c) 2020, CNRS\n# Authors: Guilhem Saurel <guilhem.saurel@laas.fr>\n\nim... | python | chosen |
[
{
"from": "system",
"value": "Revert \"Do not allow easy setting of username to something else\"\n\nThis removes the usernames completely, making it fail when we\ntry to set it later.\n\nThis reverts commit b49967ad58c520279a244a15ed81bca5453b923e.\n"
},
{
"from": "human",
"value": "import os\n\... | python | chosen |
[
{
"from": "system",
"value": "Fix import error in test suite so tests pass in Python 3.3+.\n"
},
{
"from": "human",
"value": "import pytest\nimport socket\nimport struct\nfrom threading import Thread\n\nfrom server import app\n\n\n@pytest.fixture(autouse=True, scope=\"module\")\ndef server(reque... | python | chosen |
[
{
"from": "system",
"value": "Fix another boto /dev/null testing error.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport os\nfrom tempdir import TempDir\n\nimport pytest\n\nboto = pytest.importorskip('boto')\nfrom simplekv.net.botostore import BotoStore\n\nfrom basic_store impo... | python | chosen |
[
{
"from": "system",
"value": "Add and deprecate custom expections\n"
},
{
"from": "human",
"value": "# -----------------------------------------------------------------------------\n'''General classes for a custom exceptions.'''\n\n\nclass Error(Exception):\n pass\n\n\nclass FormatError(Error... | python | chosen |
[
{
"from": "system",
"value": "Update test to new package structure\n"
},
{
"from": "human",
"value": "import unittest\r\nfrom datetime import datetime, timedelta\r\n\r\nimport sys\r\nsys.path.append(r\"..\")\r\nfrom daymetpy import download_Daymet\r\n\r\nclass TimeseriesTest(unittest.TestCase):\... | python | chosen |
[
{
"from": "system",
"value": "Set a maximum database connection age, works in django >= 1.6\n"
},
{
"from": "human",
"value": "\"\"\"\nCopyright [2009-2014] EMBL-European Bioinformatics Institute\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except... | python | chosen |
[
{
"from": "system",
"value": "Add test for string escaping\n"
},
{
"from": "human",
"value": "import pytest\n\nfrom tests.infrastructure.test_utils import lexer_single\nfrom thinglang.lexer.tokens.indent import LexicalIndent\nfrom thinglang.lexer.values.identifier import Identifier\nfrom thingla... | python | chosen |
[
{
"from": "system",
"value": "Use with context manager to handle file access\n\nCurrently, after the build completes the output file is not closed, and so it remains locked and is unable to be edited by other processes."
},
{
"from": "human",
"value": "import sublime\nimport sublime_plugin\n\nim... | python | chosen |
[
{
"from": "system",
"value": "Add github + pypi to metadata\n"
},
{
"from": "human",
"value": "__title__ = 'django-docutils'\n__package_name__ = 'django_docutils'\n__description__ = 'Documentation Utilities (Docutils, reStructuredText) for django.'\n__version__ = '0.4.0'\n__author__ = 'Tony Narl... | python | chosen |
[
{
"from": "system",
"value": "Add .tolower() when adding to DB to avoid potential issues\n"
},
{
"from": "human",
"value": "import re\nimport sqlite3\n\ndef do_karma(bot, user, channel, karma):\n if karma[1] == '++':\n k = 1\n else:\n k = -1\n\n conn = sqlite3.connect('kar... | python | chosen |
[
{
"from": "system",
"value": "Increase test coverage for ephemris"
},
{
"from": "human",
"value": "\"\"\"\ntest_heavy.py\nBlimPy\n\n\"\"\"\n\nfrom blimpy.ephemeris import Observatory\n\ndef error_msg(s):\n \"\"\" Just making clearer error messages \"\"\"\n return \"test_observatory.py: \" ... | python | chosen |
[
{
"from": "system",
"value": "Fix for checking directory and short params.\n"
},
{
"from": "human",
"value": "import os\nimport json\nimport click\n\nfrom cosmos import Data\n\n\ndef validate_filename(ctx, param, value):\n if not os.path.exists(value):\n print('No such directory: {}'.f... | python | chosen |
[
{
"from": "system",
"value": "Add string representation for colors\n"
},
{
"from": "human",
"value": "class Color(object):\n def __init__(self, r, g, b):\n self.r = r\n self.g = g\n self.b = b\n\n\nclass Line(object):\n def __init__(self, name, api_code, bg_color, fg_c... | python | chosen |
[
{
"from": "system",
"value": "Fix LIST crashing on certain input\n"
},
{
"from": "human",
"value": "from txircd.modbase import Mode\n\nclass PrivateMode(Mode):\n def listOutput(self, command, data):\n if command != \"LIST\":\n return data\n cdata = data[\"cdata\"]\n ... | python | chosen |
[
{
"from": "system",
"value": "Use modification, not creation times to determine relative newness.\n"
},
{
"from": "human",
"value": "#\n# lib.py: utility functions for the Motebopok handlers\n#\n\"\"\"This file takes the difficulties out of working with directories,\nand it also reduces clutter ... | python | chosen |
[
{
"from": "system",
"value": "Add a print statement; heroku not building :/\n"
},
{
"from": "human",
"value": "from paste.deploy import loadapp\nfrom waitress import serve\n\nfrom opreturnninja.config import config\n\nif __name__ == \"__main__\":\n app = loadapp('config:production.ini', relat... | python | chosen |
[
{
"from": "system",
"value": "Revert Reddit api to its synchonous state\n"
},
{
"from": "human",
"value": "import asyncio\nimport functools\n\nimport praw\n\n\nclass AsyncRateRedditAPI:\n def __init__(self, client_id, client_secret, user_agent, username,\n password, loop=None)... | python | chosen |
[
{
"from": "system",
"value": "Make better name for argument.\n"
},
{
"from": "human",
"value": "import os\nimport mimetypes\n\nHERE = os.path.dirname(os.path.abspath(__file__))\nMIMEMAP = os.path.join(HERE, 'mime.types')\n\n\ndef get_mimetype(path, data=None):\n mimetypes.init([MIMEMAP])\n ... | python | chosen |
[
{
"from": "system",
"value": "Use the new framework for checkers.\n"
},
{
"from": "human",
"value": "from blas_lapack_checkers import CheckCLAPACK, CheckCBLAS, CheckF77BLAS, CheckF77LAPACK\nfrom fft_checkers import CheckFFT\n\nfrom simple_check import NumpyCheckLibAndHeader\n\nfrom perflib impor... | python | chosen |
[
{
"from": "system",
"value": "Add MIME types to nbconvert exporters\n"
},
{
"from": "human",
"value": "\"\"\"Python script Exporter class\"\"\"\n\n#-----------------------------------------------------------------------------\n# Copyright (c) 2013, the IPython Development Team.\n#\n# Distributed... | python | chosen |
[
{
"from": "system",
"value": "Add fabric task for Quora example\n"
},
{
"from": "human",
"value": "# coding: utf-8\nfrom __future__ import unicode_literals, print_function\n\nfrom fabric.api import task, local, run, lcd, cd, env, shell_env\nfrom fabtools.python import virtualenv\n\nfrom _util im... | python | chosen |
[
{
"from": "system",
"value": "fix: Fix new expectations of the password reset\n"
},
{
"from": "human",
"value": "from django.test import Client, TestCase\n\nfrom django.urls import reverse\nfrom django.contrib.auth.models import User\n\nfrom ddcz.models import UserProfile\n\nclass PasswordResetT... | python | chosen |
[
{
"from": "system",
"value": "Save mnist classifier model in a file named with the network topology.\n"
},
{
"from": "human",
"value": "#!/usr/bin/env python\n\nimport cPickle\nimport gzip\nimport logging\nimport os\nimport sys\nimport tempfile\nimport urllib\n\nimport lmj.tnn\n\nlogging.basicCo... | python | chosen |
[
{
"from": "system",
"value": "Return 404 when no content found.\n\n"
},
{
"from": "human",
"value": "from flask import Flask\n\nfrom .extensions import envcfg, apierrors, applogging\nfrom .blueprints.status import blueprint as status_bp\nfrom .blueprints.content import blueprint as content_bp\nf... | python | chosen |
[
{
"from": "system",
"value": "Improve error message and imports\n"
},
{
"from": "human",
"value": "from typing import IO, Text\nfrom re import compile, MULTILINE\nfrom logging import getLogger\nfrom io import StringIO\n\nimport yaml\n\nNBSP = \"\\u00A0\"\n\npattern = compile(r\"^\\s*[\\u00A0]+\\... | python | chosen |
[
{
"from": "system",
"value": "Use the JsonMixin for the names model.\n"
},
{
"from": "human",
"value": "#from flask_security import UserMixin, RoleMixin\nfrom standard_names import StandardName\nfrom ..core import db\n\n\nclass Name(db.Model):\n __tablename__ = 'names'\n __bind_key__ = 'na... | python | chosen |
[
{
"from": "system",
"value": "Add exception for wrong type of db\n"
},
{
"from": "human",
"value": "from sqlalchemy import create_engine\r\nfrom sqlalchemy_utils import functions\r\nfrom sqlalchemy.orm import sessionmaker\r\nfrom .base import Base\r\n\r\nclass Connection:\r\n\tdef __init__(self,... | python | chosen |
[
{
"from": "system",
"value": "Add a note concerning FEINCMS_USE_PAGE_ADMIN\n"
},
{
"from": "human",
"value": "# ------------------------------------------------------------------------\n# coding=utf-8\n# ------------------------------------------------------------------------\n\nfrom __future__ ... | python | chosen |
[
{
"from": "system",
"value": "Fix wrong module name in error message\n"
},
{
"from": "human",
"value": "# -----------------------------------------------------------------------------\n# Copyright © 2009- The Spyder Development Team\n#\n# Licensed under the terms of the MIT License\n# (see LICEN... | python | chosen |
[
{
"from": "system",
"value": "Python: Add tests for more yaml loading functions\n"
},
{
"from": "human",
"value": "import yaml\nfrom yaml import SafeLoader\n\nyaml.load(payload) # $decodeInput=payload decodeOutput=Attribute() decodeFormat=YAML decodeMayExecuteInput\nyaml.load(payload, Loader=Sa... | python | chosen |
[
{
"from": "system",
"value": "Fix enabled file installed from horizon-extensions\n\nAdd the angularjs module containing the Rackspace Solutions\npanel code to the Horizon application so it works.\n\nRequires accompanying patch\nhttps://github.com/rcbops/horizon-extensions/pull/7\nfor the panel to work with ... | python | chosen |
[
{
"from": "system",
"value": "Add the host and port from the env to the config.\n"
},
{
"from": "human",
"value": "import os\n\nimport requests\nimport yaml\n\n\ndef get_session():\n sess = requests.Session()\n # Unused currently\n # sess.auth = (app.config['USERNAME'], app.config['PASS... | python | chosen |
[
{
"from": "system",
"value": "Correct __str__ & __repr__ implementations\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.conf import settings\n\n\nclass Gender(models.Model):\n name = models.CharField(max_length=20)\n\n def __str__(self):\n return self.n... | python | chosen |
[
{
"from": "system",
"value": "Disable adding virtual fields during migration\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models\n# from modeltrans.fields import TranslationField\n\n\nclass Category(models.Model):\n ... | python | chosen |
[
{
"from": "system",
"value": "[14.0][IMP] account_wallet: Remove former methods as models have been merged\n"
},
{
"from": "human",
"value": "# © 2015 Laetitia Gangloff, Acsone SA/NV (http://www.acsone.eu)\n# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n\nfrom odoo import... | python | chosen |
[
{
"from": "system",
"value": "Add a utility for local installations to use the fallback mechanism too.\n\nSigned-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>\n"
},
{
"from": "human",
"value": "from django.db import models\nfrom django.core.management.base import Comma... | python | chosen |
[
{
"from": "system",
"value": "Fix encoding error when printing messages\n\nSome messages that will be printed will contain utf-8 chars, e.g. Pokestops in European locations."
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport struct\nfrom math import cos, asin, sqrt\n\ndef distanc... | python | chosen |
[
{
"from": "system",
"value": "Fix getmembers command to get role instead of top role.\n"
},
{
"from": "human",
"value": "from discord.ext import commands\nfrom utils import *\nimport discord\nimport asyncio\nimport sqlite3\n\n\nfrom member import Member\nclass Points:\n \n \n\n def __init_... | python | chosen |
[
{
"from": "system",
"value": "Fix EAV creation form; fix form error bug\n"
},
{
"from": "human",
"value": "from django import forms\nfrom django.core.exceptions import ValidationError\n\nfrom cyder.base.eav.models import Attribute\n\n\nclass AttributeFormField(forms.CharField):\n def to_pytho... | python | chosen |
[
{
"from": "system",
"value": "Disable jobs overview for anonymous users\n"
},
{
"from": "human",
"value": "from django.views.generic import TemplateView\n\nfrom daiquiri.core.views import ModelPermissionMixin, AnonymousAccessMixin\nfrom daiquiri.core.utils import get_model_field_meta\n\nfrom .mo... | python | chosen |
[
{
"from": "system",
"value": "Use attr access vs key\n"
},
{
"from": "human",
"value": "import yaml\n\nfrom builder import utils\n\n\ndef bind_subparser(subparsers):\n parser_destroy = subparsers.add_parser('destroy')\n parser_destroy.set_defaults(func=destroy)\n return parser_destroy\n... | python | chosen |
[
{
"from": "system",
"value": "Add handler for logging to RabbitMQ\n"
},
{
"from": "human",
"value": "# Note that logging to a single file from multiple processes is NOT supported.\n# See: http://docs.python.org/2/howto/logging-cookbook.html\n# #logging-to-a-single-file-from-multiple-processes\n#... | python | chosen |
[
{
"from": "system",
"value": "Add : implemented parsing method.\n"
},
{
"from": "human",
"value": "class Parser(object):\n \"\"\"\n Parser class definition.\n\n Takes care of parsing the fail2ban log, either in \"all\" mode or \"realtime\".\n \"\"\"\n\n def __init__(self, config, ... | python | chosen |
[
{
"from": "system",
"value": "Update vigenereDicitonaryHacker: added è character\n"
},
{
"from": "human",
"value": "# Vigenere Cipher Dictionary Hacker\n# https://www.nostarch.com/crackingcodes/ (BSD Licensed)\n\nimport detectEnglish, vigenereCipher, pyperclip\n\ndef main():\n ciphertext = \"... | python | chosen |
[
{
"from": "system",
"value": "Add mock for shapely module\n\nAdding a mock for the shapely module allows ReadTheDocs to build the\ndocs even though Shapely isn't installed.\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\nimport os\nimport sphinx_rtd_theme\nimport sys\n\n\nREPO_DIR ... | python | chosen |
[
{
"from": "system",
"value": "Add create_zip fixture to get_new test to cover more branches\n"
},
{
"from": "human",
"value": "from __future__ import absolute_import, print_function\n\nfrom ..pyautoupdate.launcher import Launcher\nfrom .pytest_skipif import needinternet\nfrom .pytest_makevers im... | python | chosen |
[
{
"from": "system",
"value": "Make sure HH:MM values are allowed\n"
},
{
"from": "human",
"value": "import datetime\nimport time\n\nfrom graphite_api.render.attime import parseATTime\n\nfrom . import TestCase\n\n\nclass AtTestCase(TestCase):\n def test_parse(self):\n for value in [\n ... | python | chosen |
[
{
"from": "system",
"value": "Remove last references to flatpage so it doesnt show up on admin page\n"
},
{
"from": "human",
"value": "# -*- encoding: UTF-8 -*-\n\nfrom core import settings as stCore\nfrom django import forms\nfrom django.conf import settings as st\nfrom django.contrib.flatpages... | python | chosen |
[
{
"from": "system",
"value": "Add py solution for 678. Valid Parenthesis String\n\n678. Valid Parenthesis String: https://leetcode.com/problems/valid-parenthesis-string/\n\nApproach2:\n Maintain the lowest/highest possible stack size and check if one of\n them is invalid\n O(n) time, O(1) size\n"
... | python | chosen |
[
{
"from": "system",
"value": "[1.6.x] Bump version number for 1.6 release candidate.\n"
},
{
"from": "human",
"value": "VERSION = (1, 6, 0, 'beta', 4)\n\ndef get_version(*args, **kwargs):\n # Don't litter django/__init__.py with all the get_version stuff.\n # Only import if it's actually c... | python | chosen |
[
{
"from": "system",
"value": "Print the discovered queues in alphabetical order for convenience\n"
},
{
"from": "human",
"value": "from django.core.management.base import BaseCommand\n\nfrom ... import app_settings\nfrom ...utils import get_backend, load_extra_config\nfrom ...cron_scheduler impo... | python | chosen |
[
{
"from": "system",
"value": "Fix script that removes numerals from people's locations.\n"
},
{
"from": "human",
"value": "import re\nimport mysite\nPerson = mysite.profile.models.Person\n\npeople_with_weird_locations = Person.objects.filter(location_display_name__regex=', [0-9][0-9],')\n\nfor p... | python | chosen |
[
{
"from": "system",
"value": "Check variable for None value before null string when filtering tail numbers"
},
{
"from": "human",
"value": "# Load the on-time parquet file\non_time_dataframe = spark.read.parquet('data/on_time_performance.parquet')\n\n# The first step is easily expressed as SQL: ... | python | chosen |
[
{
"from": "system",
"value": "tests/basics: Enable tests for list slice getting with 3rd arg.\n\nAlso add a test to check case when 3rd arg is 0.\n"
},
{
"from": "human",
"value": "# test slices; only 2 argument version supported by Micro Python at the moment\nx = list(range(10))\na = 2\nb = 4\n... | python | chosen |
[
{
"from": "system",
"value": "Allow linear referencing on rings.\n\nCloses #286.\n\nEliminating the assert is good for optimization reasons, too.\n"
},
{
"from": "human",
"value": "\"\"\"Linear referencing\n\"\"\"\n\nfrom shapely.topology import Delegating\n\n\nclass LinearRefBase(Delegating):\n... | python | chosen |
[
{
"from": "system",
"value": "Add Process to the simpy namespace.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\"\"\"\nWith SimPy, simulating is fun again!\n\n\"\"\"\nfrom pkgutil import extend_path\n__path__ = extend_path(__path__, __name__)\n\nfrom simpy.core import Simulation, Interr... | python | chosen |
[
{
"from": "system",
"value": "Add a couple more test cases for item list\n"
},
{
"from": "human",
"value": "from .context import tohu\nfrom tohu.v7.item_list import ItemList\n\n\ndef test_item_list():\n values = [11, 55, 22, 66, 33]\n item_list = ItemList(values)\n assert item_list.item... | python | chosen |
[
{
"from": "system",
"value": "Change year to 2016, try to guess author details from git config\n"
},
{
"from": "human",
"value": "# -*- coding: utf-8 -*-\n\"\"\"Project metadata\n\nInformation describing the project.\n\"\"\"\n\n# The package name, which is also the \"UNIX name\" for the project.... | python | chosen |
[
{
"from": "system",
"value": "Move remove code down to fix undefined var error\n"
},
{
"from": "human",
"value": "from sugar.canvas.MenuIcon import MenuIcon\nfrom view.BuddyMenu import BuddyMenu\n\nclass BuddyIcon(MenuIcon):\n\tdef __init__(self, shell, menu_shell, friend):\n\t\tMenuIcon.__init_... | python | chosen |
[
{
"from": "system",
"value": "Add a view to display PDF receipts\n\nFixes #23\nCloses !7\nCloses !8\n"
},
{
"from": "human",
"value": "from django.http import HttpResponse\nfrom django.utils.translation import ugettext as _\nfrom django.views.generic import View\n\nfrom .pdf import generate_rece... | python | chosen |
[
{
"from": "system",
"value": "Make source utf-8 encoded bytes.\n"
},
{
"from": "human",
"value": "class BaseGrader(object):\n def __init__(self, judge, problem, language, source):\n self.source = source\n self.language = language\n self.problem = problem\n self.jud... | python | chosen |
[
{
"from": "system",
"value": "Use flask's redirect() method to go to result link\n"
},
{
"from": "human",
"value": "from flask import Flask, render_template\nfrom setup_cardsets import CardOperations\n\nco = CardOperations()\n\napp = Flask(__name__)\n\n@app.route('/')\ndef home():\n\treturn rend... | python | chosen |
[
{
"from": "system",
"value": "Set default encoding to fix unicode errors\n"
},
{
"from": "human",
"value": "__version__ = '0.5.5'\ndefault_app_config = 'mqueue.apps.MqueueConfig'\n\n\n\n"
},
{
"from": "gpt",
"value": "__version__ = '0.5.5'\ndefault_app_config = 'mqueue.apps.MqueueCon... | python | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.