###
# Copyright (c) 2012, spline
# All rights reserved.
#
#
###

"""
Add a description of the plugin (to be presented to the user inside the wizard)
here.  This should describe *what* the plugin does.
"""

import supybot
import supybot.world as world

# Use this for the version of this plugin.  You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = ""

# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.authors.unknown

# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {}

# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Scores/download'

import config
import plugin
reload(config)
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded.  Don't forget to import them as well!

if world.testing:
    import test

Class = plugin.Class
configure = config.configure

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

Add reload to init for config

Add reload to init for config

Response:
<REPLACE_OLD> plugin
reload(plugin) <REPLACE_NEW> plugin
reload(config)
reload(plugin) <REPLACE_END> <|endoftext|> ###
# Copyright (c) 2012, spline
# All rights reserved.
#
#
###

"""
Add a description of the plugin (to be presented to the user inside the wizard)
here.  This should describe *what* the plugin does.
"""

import supybot
import supybot.world as world

# Use this for the version of this plugin.  You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = ""

# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.authors.unknown

# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {}

# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Scores/download'

import config
import plugin
reload(config)
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded.  Don't forget to import them as well!

if world.testing:
    import test

Class = plugin.Class
configure = config.configure

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

Prompt:
Add reload to init for config

###
# Copyright (c) 2012, spline
# All rights reserved.
#
#
###

"""
Add a description of the plugin (to be presented to the user inside the wizard)
here.  This should describe *what* the plugin does.
"""

import supybot
import supybot.world as world

# Use this for the version of this plugin.  You may wish to put a CVS keyword
# in here if you're keeping the plugin in CVS or some similar system.
__version__ = ""

# XXX Replace this with an appropriate author or supybot.Author instance.
__author__ = supybot.authors.unknown

# This is a dictionary mapping supybot.Author instances to lists of
# contributions.
__contributors__ = {}

# This is a url where the most recent plugin package can be downloaded.
__url__ = '' # 'http://supybot.com/Members/yourname/Scores/download'

import config
import plugin
reload(plugin) # In case we're being reloaded.
# Add more reloads here if you add third-party modules and want them to be
# reloaded when this plugin is reloaded.  Don't forget to import them as well!

if world.testing:
    import test

Class = plugin.Class
configure = config.configure

# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:


# Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

import boto3

# Create SQS client
sqs = boto3.client('sqs')

queue_url = 'SQS_QUEUE_URL'

# Receive message from SQS queue
response = sqs.receive_message(
    QueueUrl=queue_url,
    AttributeNames=[
        'SentTimestamp'
    ],
    MaxNumberOfMessages=1,
    MessageAttributeNames=[
        'All'
    ],
)

message = response['Messages'][0]
receipt_handle = message['ReceiptHandle']

# Change visibility timeout of message from queue
sqs.change_message_visibility(
    QueueUrl=queue_url,
    ReceiptHandle=receipt_handle,
    VisibilityTimeout=36000
)
print('Received and changed visibilty timeout of message: %s' % message)

Add SQS visibility timeout message example

Response:
<INSERT> # Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

import boto3

# Create SQS client
sqs = boto3.client('sqs')

queue_url = 'SQS_QUEUE_URL'

# Receive message from SQS queue
response = sqs.receive_message(
 <INSERT_END> <INSERT>   QueueUrl=queue_url,
    AttributeNames=[
        'SentTimestamp'
    ],
    MaxNumberOfMessages=1,
    MessageAttributeNames=[
        'All'
    ],
)

message = response['Messages'][0]
receipt_handle = message['ReceiptHandle']

# Change visibility timeout of message from queue
sqs.change_message_visibility(
    QueueUrl=queue_url,
    ReceiptHandle=receipt_handle,
    VisibilityTimeout=36000
)
print('Received and changed visibilty timeout of message: %s' % message)
 <INSERT_END> <|endoftext|> # Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

import boto3

# Create SQS client
sqs = boto3.client('sqs')

queue_url = 'SQS_QUEUE_URL'

# Receive message from SQS queue
response = sqs.receive_message(
    QueueUrl=queue_url,
    AttributeNames=[
        'SentTimestamp'
    ],
    MaxNumberOfMessages=1,
    MessageAttributeNames=[
        'All'
    ],
)

message = response['Messages'][0]
receipt_handle = message['ReceiptHandle']

# Change visibility timeout of message from queue
sqs.change_message_visibility(
    QueueUrl=queue_url,
    ReceiptHandle=receipt_handle,
    VisibilityTimeout=36000
)
print('Received and changed visibilty timeout of message: %s' % message)

Prompt: Add SQS visibility timeout message example


from __future__ import unicode_literals
from django.core.management.base import BaseCommand

from guardian.utils import clean_orphan_obj_perms

class Command(BaseCommand):
    """
    clean_orphan_obj_perms command is a tiny wrapper around
    :func:`guardian.utils.clean_orphan_obj_perms`.

    Usage::

        $ python manage.py clean_orphan_obj_perms
        Removed 11 object permission entries with no targets

    """
    help = "Removes object permissions with not existing targets"

    def handle(self, **options):
        removed = clean_orphan_obj_perms()
        if options['verbosity'] > 0:
            print("Removed %d object permission entries with no targets" %
                  removed)

Response:
<REPLACE_OLD> NoArgsCommand

from <REPLACE_NEW> BaseCommand

from <REPLACE_END> <REPLACE_OLD> Command(NoArgsCommand):
 <REPLACE_NEW> Command(BaseCommand):
 <REPLACE_END> <REPLACE_OLD> handle_noargs(self, <REPLACE_NEW> handle(self, <REPLACE_END> <|endoftext|> from __future__ import unicode_literals
from django.core.management.base import BaseCommand

from guardian.utils import clean_orphan_obj_perms

class Command(BaseCommand):
    """
    clean_orphan_obj_perms command is a tiny wrapper around
    :func:`guardian.utils.clean_orphan_obj_perms`.

    Usage::

        $ python manage.py clean_orphan_obj_perms
        Removed 11 object permission entries with no targets

    """
    help = "Removes object permissions with not existing targets"

    def handle(self, **options):
        removed = clean_orphan_obj_perms()
        if options['verbosity'] > 0:
            print("Removed %d object permission entries with no targets" %
                  removed)

Prompt:
Drop django.core.management.base.NoArgsCommand (django 1.10 compat)

See https://github.com/django/django/blob/stable/1.9.x/django/core/management/base.py#L574-L578

from __future__ import unicode_literals
from django.core.management.base import NoArgsCommand

from guardian.utils import clean_orphan_obj_perms

class Command(NoArgsCommand):
    """
    clean_orphan_obj_perms command is a tiny wrapper around
    :func:`guardian.utils.clean_orphan_obj_perms`.

    Usage::

        $ python manage.py clean_orphan_obj_perms
        Removed 11 object permission entries with no targets

    """
    help = "Removes object permissions with not existing targets"

    def handle_noargs(self, **options):
        removed = clean_orphan_obj_perms()
        if options['verbosity'] > 0:
            print("Removed %d object permission entries with no targets" %
                  removed)


import os

from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

def assert_pyside():
    import PySide
    assert QtCore.QEvent is PySide.QtCore.QEvent
    assert QtGui.QPainter is PySide.QtGui.QPainter
    assert QtWidgets.QWidget is PySide.QtGui.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PySide.QtWebKit.QWebPage

def assert_pyqt4():
    import PyQt4
    assert QtCore.QEvent is PyQt4.QtCore.QEvent
    assert QtGui.QPainter is PyQt4.QtGui.QPainter
    assert QtWidgets.QWidget is PyQt4.QtGui.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PyQt4.QtWebKit.QWebPage

def assert_pyqt5():
    import PyQt5
    assert QtCore.QEvent is PyQt5.QtCore.QEvent
    assert QtGui.QPainter is PyQt5.QtGui.QPainter
    assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebEngineWidgets.QWebEnginePage

def test_qt_api():
    """
    If QT_API is specified, we check that the correct Qt wrapper was used
    """

    QT_API = os.environ.get('QT_API', None)

    if QT_API == 'pyside':
        assert_pyside()
    elif QT_API in ('pyqt', 'pyqt4'):
        assert_pyqt4()
    elif QT_API == 'pyqt5':
        assert_pyqt5()
    else:
        # We should then be loading, in order of decreasing preference, PyQt5,
        # PyQt4, and PySide.
        try:
            import PyQt5
        except ImportError:
            try:
                import PyQt4
            except ImportError:
                import PySide
                assert_pyside()
            else:
                assert_pyqt4()
        else:
            assert_pyqt5()

Response:
<REPLACE_OLD> os

def <REPLACE_NEW> os

from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

def assert_pyside():
    import PySide
    assert QtCore.QEvent is PySide.QtCore.QEvent
    assert QtGui.QPainter is PySide.QtGui.QPainter
    assert QtWidgets.QWidget is PySide.QtGui.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PySide.QtWebKit.QWebPage

def assert_pyqt4():
    import PyQt4
    assert QtCore.QEvent is PyQt4.QtCore.QEvent
    assert QtGui.QPainter is PyQt4.QtGui.QPainter
    assert QtWidgets.QWidget is PyQt4.QtGui.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PyQt4.QtWebKit.QWebPage

def assert_pyqt5():
    import PyQt5
    assert QtCore.QEvent is PyQt5.QtCore.QEvent
    assert QtGui.QPainter is PyQt5.QtGui.QPainter
    assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebEngineWidgets.QWebEnginePage

def <REPLACE_END> <DELETE> from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

    <DELETE_END> <REPLACE_OLD> import PySide
        assert QtCore.QEvent is PySide.QtCore.QEvent
        assert QtGui.QPainter is PySide.QtGui.QPainter
        assert QtWidgets.QWidget is PySide.QtGui.QWidget
        assert QtWebEngineWidgets.QWebEnginePage is PySide.QtWebKit.QWebPage
 <REPLACE_NEW> assert_pyside()
 <REPLACE_END> <REPLACE_OLD> import PyQt4
        assert QtCore.QEvent is PyQt4.QtCore.QEvent
        assert QtGui.QPainter is PyQt4.QtGui.QPainter
        assert QtWidgets.QWidget is PyQt4.QtGui.QWidget
        assert QtWebEngineWidgets.QWebEnginePage is PyQt4.QtWebKit.QWebPage
 <REPLACE_NEW> assert_pyqt4()
 <REPLACE_END> <INSERT> assert_pyqt5()
    else:
        # We should then be loading, in order of decreasing preference, PyQt5,
        # PyQt4, and PySide.
        try:
            <INSERT_END> <REPLACE_OLD> assert QtCore.QEvent is PyQt5.QtCore.QEvent
        assert QtGui.QPainter is PyQt5.QtGui.QPainter
        assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget
        assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebEngineWidgets.QWebEnginePage
 <REPLACE_NEW> except ImportError:
            try:
                import PyQt4
            except ImportError:
                import PySide
                assert_pyside()
         <REPLACE_END> <REPLACE_OLD> pass
 <REPLACE_NEW>         assert_pyqt4()
        else:
            assert_pyqt5()
 <REPLACE_END> <|endoftext|> import os

from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

def assert_pyside():
    import PySide
    assert QtCore.QEvent is PySide.QtCore.QEvent
    assert QtGui.QPainter is PySide.QtGui.QPainter
    assert QtWidgets.QWidget is PySide.QtGui.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PySide.QtWebKit.QWebPage

def assert_pyqt4():
    import PyQt4
    assert QtCore.QEvent is PyQt4.QtCore.QEvent
    assert QtGui.QPainter is PyQt4.QtGui.QPainter
    assert QtWidgets.QWidget is PyQt4.QtGui.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PyQt4.QtWebKit.QWebPage

def assert_pyqt5():
    import PyQt5
    assert QtCore.QEvent is PyQt5.QtCore.QEvent
    assert QtGui.QPainter is PyQt5.QtGui.QPainter
    assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget
    assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebEngineWidgets.QWebEnginePage

def test_qt_api():
    """
    If QT_API is specified, we check that the correct Qt wrapper was used
    """

    QT_API = os.environ.get('QT_API', None)

    if QT_API == 'pyside':
        assert_pyside()
    elif QT_API in ('pyqt', 'pyqt4'):
        assert_pyqt4()
    elif QT_API == 'pyqt5':
        assert_pyqt5()
    else:
        # We should then be loading, in order of decreasing preference, PyQt5,
        # PyQt4, and PySide.
        try:
            import PyQt5
        except ImportError:
            try:
                import PyQt4
            except ImportError:
                import PySide
                assert_pyside()
            else:
                assert_pyqt4()
        else:
            assert_pyqt5()

Prompt:
Check that the priority order is respected if QT_API or USE_QT_API are not specified.
import os

def test_qt_api():
    """
    If QT_API is specified, we check that the correct Qt wrapper was used
    """

    from qtpy import QtCore, QtGui, QtWidgets, QtWebEngineWidgets

    QT_API = os.environ.get('QT_API', None)

    if QT_API == 'pyside':
        import PySide
        assert QtCore.QEvent is PySide.QtCore.QEvent
        assert QtGui.QPainter is PySide.QtGui.QPainter
        assert QtWidgets.QWidget is PySide.QtGui.QWidget
        assert QtWebEngineWidgets.QWebEnginePage is PySide.QtWebKit.QWebPage
    elif QT_API in ('pyqt', 'pyqt4'):
        import PyQt4
        assert QtCore.QEvent is PyQt4.QtCore.QEvent
        assert QtGui.QPainter is PyQt4.QtGui.QPainter
        assert QtWidgets.QWidget is PyQt4.QtGui.QWidget
        assert QtWebEngineWidgets.QWebEnginePage is PyQt4.QtWebKit.QWebPage
    elif QT_API == 'pyqt5':
        import PyQt5
        assert QtCore.QEvent is PyQt5.QtCore.QEvent
        assert QtGui.QPainter is PyQt5.QtGui.QPainter
        assert QtWidgets.QWidget is PyQt5.QtWidgets.QWidget
        assert QtWebEngineWidgets.QWebEnginePage is PyQt5.QtWebEngineWidgets.QWebEnginePage
    else:
        pass


# -*- coding: utf-8 -*-
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Developer Shell auth bridge.

This enables Boto API auth in Developer Shell environment.
"""

from __future__ import absolute_import

from boto.auth_handler import AuthHandler
from boto.auth_handler import NotReadyToAuthenticate
import oauth2client.contrib.devshell as devshell

class DevshellAuth(AuthHandler):
  """Developer Shell authorization plugin class."""

  capability = ['s3']

  def __init__(self, path, config, provider):
    # Provider here is a boto.provider.Provider object (as opposed to the
    # provider attribute of CloudApi objects, which is a string).
    if provider.name != 'google':
      # Devshell credentials are valid for Google only and can't be used for s3.
      raise NotReadyToAuthenticate()
    try:
      self.creds = devshell.DevshellCredentials()
    except:
      raise NotReadyToAuthenticate()

  def add_auth(self, http_request):
    http_request.headers['Authorization'] = ('Bearer %s' %
                                             self.creds.access_token)

Response:
<INSERT> # Provider here is a boto.provider.Provider object (as opposed to the
    # provider attribute of CloudApi objects, which is a string).
    <INSERT_END> <REPLACE_OLD> provider <REPLACE_NEW> provider.name <REPLACE_END> <REPLACE_OLD> 'gs':
 <REPLACE_NEW> 'google':
 <REPLACE_END> <|endoftext|> # -*- coding: utf-8 -*-
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Developer Shell auth bridge.

This enables Boto API auth in Developer Shell environment.
"""

from __future__ import absolute_import

from boto.auth_handler import AuthHandler
from boto.auth_handler import NotReadyToAuthenticate
import oauth2client.contrib.devshell as devshell

class DevshellAuth(AuthHandler):
  """Developer Shell authorization plugin class."""

  capability = ['s3']

  def __init__(self, path, config, provider):
    # Provider here is a boto.provider.Provider object (as opposed to the
    # provider attribute of CloudApi objects, which is a string).
    if provider.name != 'google':
      # Devshell credentials are valid for Google only and can't be used for s3.
      raise NotReadyToAuthenticate()
    try:
      self.creds = devshell.DevshellCredentials()
    except:
      raise NotReadyToAuthenticate()

  def add_auth(self, http_request):
    http_request.headers['Authorization'] = ('Bearer %s' %
                                             self.creds.access_token)

Prompt:
Fix provider check causing Devshell auth failure

This commit builds on commit 13c4926, allowing Devshell credentials to
be used only with Google storage.

# -*- coding: utf-8 -*-
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Developer Shell auth bridge.

This enables Boto API auth in Developer Shell environment.
"""

from __future__ import absolute_import

from boto.auth_handler import AuthHandler
from boto.auth_handler import NotReadyToAuthenticate
import oauth2client.contrib.devshell as devshell

class DevshellAuth(AuthHandler):
  """Developer Shell authorization plugin class."""

  capability = ['s3']

  def __init__(self, path, config, provider):
    if provider != 'gs':
      # Devshell credentials are valid for Google only and can't be used for s3.
      raise NotReadyToAuthenticate()
    try:
      self.creds = devshell.DevshellCredentials()
    except:
      raise NotReadyToAuthenticate()

  def add_auth(self, http_request):
    http_request.headers['Authorization'] = ('Bearer %s' %
                                             self.creds.access_token)


# encoding: utf-8

from marathon.models.base import MarathonObject
from marathon.models.base import MarathonResource
import unittest

class MarathonObjectTest(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonObject defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonObjects are hashable, but in Python3 they're not,

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonObject()
        collection = {}
        collection[obj] = True
        assert collection[obj]

class MarathonResourceHashable(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonResource defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonResources are hashable, but in Python3 they're
        not

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonResource()
        collection = {}
        collection[obj] = True
        assert collection[obj]

Response:
<REPLACE_OLD> MarathonObject
import <REPLACE_NEW> MarathonObject
from marathon.models.base import MarathonResource
import <REPLACE_END> <INSERT> collection[obj]

class MarathonResourceHashable(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonResource defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonResources are hashable, but in Python3 they're
        not

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonResource()
        collection = {}
        collection[obj] = True
        assert <INSERT_END> <|endoftext|> # encoding: utf-8

from marathon.models.base import MarathonObject
from marathon.models.base import MarathonResource
import unittest

class MarathonObjectTest(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonObject defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonObjects are hashable, but in Python3 they're not,

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonObject()
        collection = {}
        collection[obj] = True
        assert collection[obj]

class MarathonResourceHashable(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonResource defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonResources are hashable, but in Python3 they're
        not

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonResource()
        collection = {}
        collection[obj] = True
        assert collection[obj]

Prompt:
Add regression test for MarathonResource

# encoding: utf-8

from marathon.models.base import MarathonObject
import unittest

class MarathonObjectTest(unittest.TestCase):

    def test_hashable(self):
        """
        Regression test for issue #203

        MarathonObject defined __eq__ but not __hash__, meaning that in
        in Python2.7 MarathonObjects are hashable, but in Python3 they're not,

        This test ensures that we are hashable in all versions of python
        """
        obj = MarathonObject()
        collection = {}
        collection[obj] = True
        assert collection[obj]


try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

config = {
    'description': 'Python Connector for Mongrel2',
    'author': 'Zed A. Shaw',
    'url': 'http://pypi.python.org/pypi/mongrel2-python',
    'download_url': 'http://pypi.python.org/pypi/mongrel2-python',
    'author_email': 'zedshaw@zedshaw.com',
    'version': '1.0beta5',
    'scripts': ['bin/m2sh'],
    'install_requires': ['nose', 'simplejson', 'pyrepl', 'storm'],
    'packages': ['mongrel2', 'mongrel2.config'],
    'package_data': {'mongrel2': ['sql/config.sql']},
    'name': 'm2py'
}

setup(**config)

Response:
<REPLACE_OLD> '0.2',
 <REPLACE_NEW> '1.0beta5',
 <REPLACE_END> <|endoftext|>
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

config = {
    'description': 'Python Connector for Mongrel2',
    'author': 'Zed A. Shaw',
    'url': 'http://pypi.python.org/pypi/mongrel2-python',
    'download_url': 'http://pypi.python.org/pypi/mongrel2-python',
    'author_email': 'zedshaw@zedshaw.com',
    'version': '1.0beta5',
    'scripts': ['bin/m2sh'],
    'install_requires': ['nose', 'simplejson', 'pyrepl', 'storm'],
    'packages': ['mongrel2', 'mongrel2.config'],
    'package_data': {'mongrel2': ['sql/config.sql']},
    'name': 'm2py'
}

setup(**config)

Prompt:
Make m2sh have the same version number as mongrel2.

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

config = {
    'description': 'Python Connector for Mongrel2',
    'author': 'Zed A. Shaw',
    'url': 'http://pypi.python.org/pypi/mongrel2-python',
    'download_url': 'http://pypi.python.org/pypi/mongrel2-python',
    'author_email': 'zedshaw@zedshaw.com',
    'version': '0.2',
    'scripts': ['bin/m2sh'],
    'install_requires': ['nose', 'simplejson', 'pyrepl', 'storm'],
    'packages': ['mongrel2', 'mongrel2.config'],
    'package_data': {'mongrel2': ['sql/config.sql']},
    'name': 'm2py'
}

setup(**config)


from flask import Blueprint
from flask import render_template
from flask import request

spring_evals_bp = Blueprint('spring_evals_bp', __name__)

@spring_evals_bp.route('/spring_evals/')
def display_spring_evals():
    # get user data

    user_name = request.headers.get('x-webauth-user')

    members = [
                {
                    'name': "Liam Middlebrook",
                    'committee_meetings': 24,
                    'house_meetings_missed': [{'date': "aprial fools fayas ads", 'reason': "I was playing videogames"}],
                    'major_project': 'open_container',
                    'major_project_passed': True,
                    'social_events': "",
                    'comments': "please don't fail me",
                    'result': 'Pending'
                },
                {
                    'name': "Julien Eid",
                    'committee_meetings': 69,
                    'house_meetings_missed': [],
                    'major_project': 'wii-u shit',
                    'major_project_passed': True,
                    'social_events': "Manipulation and Opportunism",
                    'comments': "imdabes",
                    'result': 'Passed'
                }
            ]
    # return names in 'first last (username)' format
    return render_template('spring_evals.html',
                            username = user_name,
                            members = members)

Add social events to spring evals 😿

Add social events to spring evals 😿

Response:
<INSERT> 'social_events': "",
                    <INSERT_END> <INSERT>                    'social_events': "Manipulation and Opportunism",
 <INSERT_END> <|endoftext|> from flask import Blueprint
from flask import render_template
from flask import request

spring_evals_bp = Blueprint('spring_evals_bp', __name__)

@spring_evals_bp.route('/spring_evals/')
def display_spring_evals():
    # get user data

    user_name = request.headers.get('x-webauth-user')

    members = [
                {
                    'name': "Liam Middlebrook",
                    'committee_meetings': 24,
                    'house_meetings_missed': [{'date': "aprial fools fayas ads", 'reason': "I was playing videogames"}],
                    'major_project': 'open_container',
                    'major_project_passed': True,
                    'social_events': "",
                    'comments': "please don't fail me",
                    'result': 'Pending'
                },
                {
                    'name': "Julien Eid",
                    'committee_meetings': 69,
                    'house_meetings_missed': [],
                    'major_project': 'wii-u shit',
                    'major_project_passed': True,
                    'social_events': "Manipulation and Opportunism",
                    'comments': "imdabes",
                    'result': 'Passed'
                }
            ]
    # return names in 'first last (username)' format
    return render_template('spring_evals.html',
                            username = user_name,
                            members = members)

Prompt:
Add social events to spring evals 😿

from flask import Blueprint
from flask import render_template
from flask import request

spring_evals_bp = Blueprint('spring_evals_bp', __name__)

@spring_evals_bp.route('/spring_evals/')
def display_spring_evals():
    # get user data

    user_name = request.headers.get('x-webauth-user')

    members = [
                {
                    'name': "Liam Middlebrook",
                    'committee_meetings': 24,
                    'house_meetings_missed': [{'date': "aprial fools fayas ads", 'reason': "I was playing videogames"}],
                    'major_project': 'open_container',
                    'major_project_passed': True,
                    'comments': "please don't fail me",
                    'result': 'Pending'
                },
                {
                    'name': "Julien Eid",
                    'committee_meetings': 69,
                    'house_meetings_missed': [],
                    'major_project': 'wii-u shit',
                    'major_project_passed': True,
                    'comments': "imdabes",
                    'result': 'Passed'
                }
            ]
    # return names in 'first last (username)' format
    return render_template('spring_evals.html',
                            username = user_name,
                            members = members)


"""Models."""
from django.db import models

# Create your models here.

class ImagerProfile(models.Model):
    """Imager Profile Model."""

    camera_model = models.CharField(max_length=200)
    photography_type = models.TextField()
    friends = models.ManyToManyField('self')
    region = models.CharField(max_length=200)

Response:
<REPLACE_OLD> Friends <REPLACE_NEW> friends <REPLACE_END> <REPLACE_OLD> Region <REPLACE_NEW> region <REPLACE_END> <|endoftext|> """Models."""
from django.db import models

# Create your models here.

class ImagerProfile(models.Model):
    """Imager Profile Model."""

    camera_model = models.CharField(max_length=200)
    photography_type = models.TextField()
    friends = models.ManyToManyField('self')
    region = models.CharField(max_length=200)

Prompt:
Change model fields to lower case letters

"""Models."""
from django.db import models

# Create your models here.

class ImagerProfile(models.Model):
    """Imager Profile Model."""

    camera_model = models.CharField(max_length=200)
    photography_type = models.TextField()
    Friends = models.ManyToManyField('self')
    Region = models.CharField(max_length=200)


from constants import *
import collections
import uuid

class CallBuffer():
    def __init__(self):
        self.waiters = set()
        self.cache = collections.deque(maxlen=CALL_CACHE_MAX)
        self.call_waiters = {}

    def wait_for_calls(self, callback, cursor=None):
        if cursor:
            calls = []
            cursor_found = False
            for call in self.cache:
                if call['id'] == cursor:
                    cursor_found = True
                    continue
                if not cursor_found:
                    continue
                calls.append(call)
            if calls:
                callback(calls)
                return
        self.waiters.add(callback)

    def return_call(self, id, response):
        callback = self.call_waiters.pop(id, None)
        if callback:
            callback(response)

    def create_call(self, command, args, callback=None):
        call_id = uuid.uuid4().hex
        call = {
            'id': call_id,
            'command': command,
            'args': args,
        }

        if callback:
            self.call_waiters[call_id] = callback
        self.cache.append(call)

        for callback in self.waiters:
            callback([call])
        self.waiters = set()

Add optional callbacks for call buffer

Add optional callbacks for call buffer

Response:
<REPLACE_OLD> self.call_waiters.pop(id)
 <REPLACE_NEW> self.call_waiters.pop(id, None)
 <REPLACE_END> <REPLACE_OLD> callback):
 <REPLACE_NEW> callback=None):
 <REPLACE_END> <INSERT>        if callback:
     <INSERT_END> <|endoftext|> from constants import *
import collections
import uuid

class CallBuffer():
    def __init__(self):
        self.waiters = set()
        self.cache = collections.deque(maxlen=CALL_CACHE_MAX)
        self.call_waiters = {}

    def wait_for_calls(self, callback, cursor=None):
        if cursor:
            calls = []
            cursor_found = False
            for call in self.cache:
                if call['id'] == cursor:
                    cursor_found = True
                    continue
                if not cursor_found:
                    continue
                calls.append(call)
            if calls:
                callback(calls)
                return
        self.waiters.add(callback)

    def return_call(self, id, response):
        callback = self.call_waiters.pop(id, None)
        if callback:
            callback(response)

    def create_call(self, command, args, callback=None):
        call_id = uuid.uuid4().hex
        call = {
            'id': call_id,
            'command': command,
            'args': args,
        }

        if callback:
            self.call_waiters[call_id] = callback
        self.cache.append(call)

        for callback in self.waiters:
            callback([call])
        self.waiters = set()

Prompt:
Add optional callbacks for call buffer

from constants import *
import collections
import uuid

class CallBuffer():
    def __init__(self):
        self.waiters = set()
        self.cache = collections.deque(maxlen=CALL_CACHE_MAX)
        self.call_waiters = {}

    def wait_for_calls(self, callback, cursor=None):
        if cursor:
            calls = []
            cursor_found = False
            for call in self.cache:
                if call['id'] == cursor:
                    cursor_found = True
                    continue
                if not cursor_found:
                    continue
                calls.append(call)
            if calls:
                callback(calls)
                return
        self.waiters.add(callback)

    def return_call(self, id, response):
        callback = self.call_waiters.pop(id)
        if callback:
            callback(response)

    def create_call(self, command, args, callback):
        call_id = uuid.uuid4().hex
        call = {
            'id': call_id,
            'command': command,
            'args': args,
        }

        self.call_waiters[call_id] = callback
        self.cache.append(call)

        for callback in self.waiters:
            callback([call])
        self.waiters = set()


#!/usr/bin/env python

from distutils.core import setup

setup(name="minishift-python",
      version="0.1.3",
      description="Python interface for the minishift",
      author="Nick Johnson",
      author_email="nick@arachnidlabs.com",
      url="https://github.com/arachnidlabs/minishift-python/",
      packages=["minishift"],
      install_requires=["mcp2210", "python-daemon"])

Add python-daemon as a dep

Add python-daemon as a dep

Response:
<REPLACE_OLD> version="0.1.2",
 <REPLACE_NEW> version="0.1.3",
 <REPLACE_END> <REPLACE_OLD> requires=["mcp2210"])
 <REPLACE_NEW> install_requires=["mcp2210", "python-daemon"])
 <REPLACE_END> <|endoftext|> #!/usr/bin/env python

from distutils.core import setup

setup(name="minishift-python",
      version="0.1.3",
      description="Python interface for the minishift",
      author="Nick Johnson",
      author_email="nick@arachnidlabs.com",
      url="https://github.com/arachnidlabs/minishift-python/",
      packages=["minishift"],
      install_requires=["mcp2210", "python-daemon"])

Prompt:
Add python-daemon as a dep

#!/usr/bin/env python

from distutils.core import setup

setup(name="minishift-python",
      version="0.1.2",
      description="Python interface for the minishift",
      author="Nick Johnson",
      author_email="nick@arachnidlabs.com",
      url="https://github.com/arachnidlabs/minishift-python/",
      packages=["minishift"],
      requires=["mcp2210"])


import os
import pathlib
import sys

import toml

# Allow autodoc to import listparser.
sys.path.append(os.path.abspath("../src"))

# General configuration
# ---------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc"]

# The suffix of source filenames.
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# General information about the project.
project = "listparser"
copyright = "2009-2022 Kurt McKee"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
info = toml.load(pathlib.Path(__file__).parent.parent / "pyproject.toml")
version = release = info["tool"]["poetry"]["version"]

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ()

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

Response:
<REPLACE_OLD> toml.load(pathlib.Path(__file__) <REPLACE_NEW> toml.load(pathlib.Path(__file__).parent.parent <REPLACE_END> <REPLACE_OLD> "../../pyproject.toml")
version <REPLACE_NEW> "pyproject.toml")
version <REPLACE_END> <|endoftext|> import os
import pathlib
import sys

import toml

# Allow autodoc to import listparser.
sys.path.append(os.path.abspath("../src"))

# General configuration
# ---------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc"]

# The suffix of source filenames.
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# General information about the project.
project = "listparser"
copyright = "2009-2022 Kurt McKee"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
info = toml.load(pathlib.Path(__file__).parent.parent / "pyproject.toml")
version = release = info["tool"]["poetry"]["version"]

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ()

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"

Prompt:
Fix a build error reported by ReadTheDocs

import os
import pathlib
import sys

import toml

# Allow autodoc to import listparser.
sys.path.append(os.path.abspath("../src"))

# General configuration
# ---------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ["sphinx.ext.autodoc"]

# The suffix of source filenames.
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"

# General information about the project.
project = "listparser"
copyright = "2009-2022 Kurt McKee"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
info = toml.load(pathlib.Path(__file__) / "../../pyproject.toml")
version = release = info["tool"]["poetry"]["version"]

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ()

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"


import pytest
from keras.utils.generic_utils import custom_object_scope
from keras import activations
from keras import regularizers

def test_custom_objects_scope():

    def custom_fn():
        pass

    class CustomClass(object):
        pass

    with custom_object_scope({'CustomClass': CustomClass,
                              'custom_fn': custom_fn}):
        act = activations.get('custom_fn')
        assert act == custom_fn
        cl = regularizers.get('CustomClass')
        assert cl.__class__ == CustomClass

if __name__ == '__main__':
    pytest.main([__file__])

Add unit test for custom objects scope.

Add unit test for custom objects scope.

Response:
<INSERT> import pytest
from keras.utils.generic_utils import custom_object_scope
from keras import activations
from keras import regularizers

def test_custom_objects_scope():

 <INSERT_END> <INSERT>   def custom_fn():
        pass

    class CustomClass(object):
        pass

    with custom_object_scope({'CustomClass': CustomClass,
                              'custom_fn': custom_fn}):
        act = activations.get('custom_fn')
        assert act == custom_fn
        cl = regularizers.get('CustomClass')
        assert cl.__class__ == CustomClass

if __name__ == '__main__':
    pytest.main([__file__])
 <INSERT_END> <|endoftext|> import pytest
from keras.utils.generic_utils import custom_object_scope
from keras import activations
from keras import regularizers

def test_custom_objects_scope():

    def custom_fn():
        pass

    class CustomClass(object):
        pass

    with custom_object_scope({'CustomClass': CustomClass,
                              'custom_fn': custom_fn}):
        act = activations.get('custom_fn')
        assert act == custom_fn
        cl = regularizers.get('CustomClass')
        assert cl.__class__ == CustomClass

if __name__ == '__main__':
    pytest.main([__file__])

Prompt: Add unit test for custom objects scope.


#!/usr/bin/env python

import argparse
import pprint

DEFAULT_CONFIG_FILE_NAME = 'CsvToSepaDD.config'
DEFAULT_CURRENCY = 'EUR'

def csvToSepa(args):
    '''
    [TODO] Converts the SEPA direct debit data from a given CSV file to SEPA XML
    '''
    pass

def createConfig(args):
    '''Interactively creates a configuation file'''

    fileName = raw_input('configuration file name [%s]: ' % DEFAULT_CONFIG_FILE_NAME)
    if not fileName:
        fileName = DEFAULT_CONFIG_FILE_NAME
    name = raw_input('your name: ')
    iban = raw_input('your IBAN: ')
    bic = raw_input('your BIC: ')
    creditorId = raw_input('your creditor id: ')
    currency = raw_input('your currency [%s]: ' % DEFAULT_CURRENCY)
    if not currency:
        currency = DEFAULT_CURRENCY

    config = {
            'name': name,
            'iban': iban,
            'bic':  bic,
            'creditor_id': creditorId,
            'currency': currency,
    }

    with open(fileName, 'w') as f:
        pprint.pprint(config, stream=f, indent=4)

    print 'Configuration written to %s. ' \
          'You can edit this file with a text ' \
          'editor if you need to change something later.' % fileName

if __name__ == '__main__':

    parser = argparse.ArgumentParser(description='Create SEPA XML direct debit files from CSV')
    subparsers = parser.add_subparsers()
    genConfigParser = subparsers.add_parser('genconfig', help='generate a configuration file')
    genConfigParser.set_defaults(func=createConfig)
    genConfigParser.add_argument('config', help='name of the configuration file')
    convertParser = subparsers.add_parser('convert', help='convert a CSV file to a SEPA XML file')
    convertParser.set_defaults(func=csvToSepa)
    convertParser.add_argument('config', help='configuration file to use')
    convertParser.add_argument('input', help='input file or - for stdin')
    convertParser.add_argument('output', help='output file or - for stdout')

    args = parser.parse_args()
    args.func(args)

Add a first draft for the user interface

Response:
<REPLACE_OLD>  <REPLACE_NEW> #!/usr/bin/env python

import argparse
import pprint

DEFAULT_CONFIG_FILE_NAME = 'CsvToSepaDD.config'
DEFAULT_CURRENCY = 'EUR'

def csvToSepa(args):
    '''
    [TODO] Converts the SEPA direct debit data from a given CSV file to SEPA XML
    '''
    pass

def createConfig(args):
    '''Interactively creates a configuation file'''

    fileName = raw_input('configuration file name [%s]: ' % DEFAULT_CONFIG_FILE_NAME)
    if not fileName:
        fileName = DEFAULT_CONFIG_FILE_NAME
    name = raw_input('your name: ')
    iban = raw_input('your IBAN: ')
    bic = raw_input('your BIC: ')
    creditorId = raw_input('your creditor id: ')
    currency = raw_input('your currency [%s]: ' % DEFAULT_CURRENCY)
    if not currency:
        currency = DEFAULT_CURRENCY

    config = {
            'name': name,
            'iban': iban,
            'bic':  bic,
            'creditor_id': creditorId,
            'currency': currency,
    }

    with open(fileName, 'w') as f:
        pprint.pprint(config, stream=f, indent=4)

    print 'Configuration written to %s. ' \
          'You can edit this file with a text ' \
          'editor if you need to change something later.' % fileName

if __name__ == '__main__':

    parser = argparse.ArgumentParser(description='Create SEPA XML direct debit files from CSV')
    subparsers = parser.add_subparsers()
    genConfigParser = subparsers.add_parser('genconfig', help='generate a configuration file')
    genConfigParser.set_defaults(func=createConfig)
    genConfigParser.add_argument('config', help='name of the configuration file')
    convertParser = subparsers.add_parser('convert', help='convert a CSV file to a SEPA XML file')
    convertParser.set_defaults(func=csvToSepa)
    convertParser.add_argument('config', help='configuration file to use')
    convertParser.add_argument('input', help='input file or - for stdin')
    convertParser.add_argument('output', help='output file or - for stdout')

    args = parser.parse_args()
    args.func(args)
 <REPLACE_END> <|endoftext|> #!/usr/bin/env python

import argparse
import pprint

DEFAULT_CONFIG_FILE_NAME = 'CsvToSepaDD.config'
DEFAULT_CURRENCY = 'EUR'

def csvToSepa(args):
    '''
    [TODO] Converts the SEPA direct debit data from a given CSV file to SEPA XML
    '''
    pass

def createConfig(args):
    '''Interactively creates a configuation file'''

    fileName = raw_input('configuration file name [%s]: ' % DEFAULT_CONFIG_FILE_NAME)
    if not fileName:
        fileName = DEFAULT_CONFIG_FILE_NAME
    name = raw_input('your name: ')
    iban = raw_input('your IBAN: ')
    bic = raw_input('your BIC: ')
    creditorId = raw_input('your creditor id: ')
    currency = raw_input('your currency [%s]: ' % DEFAULT_CURRENCY)
    if not currency:
        currency = DEFAULT_CURRENCY

    config = {
            'name': name,
            'iban': iban,
            'bic':  bic,
            'creditor_id': creditorId,
            'currency': currency,
    }

    with open(fileName, 'w') as f:
        pprint.pprint(config, stream=f, indent=4)

    print 'Configuration written to %s. ' \
          'You can edit this file with a text ' \
          'editor if you need to change something later.' % fileName

if __name__ == '__main__':

    parser = argparse.ArgumentParser(description='Create SEPA XML direct debit files from CSV')
    subparsers = parser.add_subparsers()
    genConfigParser = subparsers.add_parser('genconfig', help='generate a configuration file')
    genConfigParser.set_defaults(func=createConfig)
    genConfigParser.add_argument('config', help='name of the configuration file')
    convertParser = subparsers.add_parser('convert', help='convert a CSV file to a SEPA XML file')
    convertParser.set_defaults(func=csvToSepa)
    convertParser.add_argument('config', help='configuration file to use')
    convertParser.add_argument('input', help='input file or - for stdin')
    convertParser.add_argument('output', help='output file or - for stdout')

    args = parser.parse_args()
    args.func(args)

Prompt: Add a first draft for the user interface


from seleniumbase import BaseCase

class MyTourClass(BaseCase):

    def test_google_tour(self):
        self.open('https://google.com')
        self.wait_for_element('input[title="Search"]')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step(
            "Click to begin the Google Tour!", title="SeleniumBase Tours")
        self.add_tour_step(
            "Type in your search query here.", 'input[title="Search"]')
        self.add_tour_step(
            "Then click here to search!", 'input[value="Google Search"]',
            alignment="bottom")
        self.add_tour_step(
            "Or click here to see the top result.",
            '''[value="I'm Feeling Lucky"]''',
            alignment="bottom")
        self.add_tour_step("Here's an example Google search:")
        self.play_tour()

        self.highlight_update_text('input[title="Search"]', "GitHub")
        self.highlight_click('input[value="Google Search"]')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step(
            "Search results appear here!", title="(5-second autoplay on)")
        self.add_tour_step("Let's take another tour:")
        self.play_tour(interval=5)  # tour automatically continues after 5 sec

        self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
        self.wait_for_element('input#searchboxinput')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step("Welcome to Google Maps!")
        self.add_tour_step(
            "Type in a location here.", "#searchboxinput", title="Search Box")
        self.add_tour_step(
            "Then click here to show it on the map.",
            "#searchbox-searchbutton", alignment="bottom")
        self.add_tour_step(
            "Or click here to get driving directions.",
            "#searchbox-directions", alignment="bottom")
        self.add_tour_step(
            "Use this button to switch to Satellite view.",
            "div.widget-minimap", alignment="right")
        self.add_tour_step(
            "Click here to zoom in.", "#widget-zoom-in", alignment="left")
        self.add_tour_step(
            "Or click here to zoom out.", "#widget-zoom-out", alignment="left")
        self.add_tour_step(
            "Use the Menu button to see more options.",
            ".searchbox-hamburger-container", alignment="right")
        self.add_tour_step(
            "Or click here to see more Google apps.", '[title="Google apps"]',
            alignment="left")
        self.add_tour_step(
            "Thanks for trying out SeleniumBase Tours!",
            title="End of Guided Tour")
        self.play_tour()

Add Bootstrap Google Tour example

Add Bootstrap Google Tour example

Response:
<REPLACE_OLD>  <REPLACE_NEW> from seleniumbase import BaseCase

class MyTourClass(BaseCase):

    def test_google_tour(self):
        self.open('https://google.com')
        self.wait_for_element('input[title="Search"]')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step(
            "Click to begin the Google Tour!", title="SeleniumBase Tours")
        self.add_tour_step(
            "Type in your search query here.", 'input[title="Search"]')
        self.add_tour_step(
            "Then click here to search!", 'input[value="Google Search"]',
            alignment="bottom")
        self.add_tour_step(
            "Or click here to see the top result.",
            '''[value="I'm Feeling Lucky"]''',
            alignment="bottom")
        self.add_tour_step("Here's an example Google search:")
        self.play_tour()

        self.highlight_update_text('input[title="Search"]', "GitHub")
        self.highlight_click('input[value="Google Search"]')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step(
            "Search results appear here!", title="(5-second autoplay on)")
        self.add_tour_step("Let's take another tour:")
        self.play_tour(interval=5)  # tour automatically continues after 5 sec

        self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
        self.wait_for_element('input#searchboxinput')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step("Welcome to Google Maps!")
        self.add_tour_step(
            "Type in a location here.", "#searchboxinput", title="Search Box")
        self.add_tour_step(
            "Then click here to show it on the map.",
            "#searchbox-searchbutton", alignment="bottom")
        self.add_tour_step(
            "Or click here to get driving directions.",
            "#searchbox-directions", alignment="bottom")
        self.add_tour_step(
            "Use this button to switch to Satellite view.",
            "div.widget-minimap", alignment="right")
        self.add_tour_step(
            "Click here to zoom in.", "#widget-zoom-in", alignment="left")
        self.add_tour_step(
            "Or click here to zoom out.", "#widget-zoom-out", alignment="left")
        self.add_tour_step(
            "Use the Menu button to see more options.",
            ".searchbox-hamburger-container", alignment="right")
        self.add_tour_step(
            "Or click here to see more Google apps.", '[title="Google apps"]',
            alignment="left")
        self.add_tour_step(
            "Thanks for trying out SeleniumBase Tours!",
            title="End of Guided Tour")
        self.play_tour()
 <REPLACE_END> <|endoftext|> from seleniumbase import BaseCase

class MyTourClass(BaseCase):

    def test_google_tour(self):
        self.open('https://google.com')
        self.wait_for_element('input[title="Search"]')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step(
            "Click to begin the Google Tour!", title="SeleniumBase Tours")
        self.add_tour_step(
            "Type in your search query here.", 'input[title="Search"]')
        self.add_tour_step(
            "Then click here to search!", 'input[value="Google Search"]',
            alignment="bottom")
        self.add_tour_step(
            "Or click here to see the top result.",
            '''[value="I'm Feeling Lucky"]''',
            alignment="bottom")
        self.add_tour_step("Here's an example Google search:")
        self.play_tour()

        self.highlight_update_text('input[title="Search"]', "GitHub")
        self.highlight_click('input[value="Google Search"]')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step(
            "Search results appear here!", title="(5-second autoplay on)")
        self.add_tour_step("Let's take another tour:")
        self.play_tour(interval=5)  # tour automatically continues after 5 sec

        self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
        self.wait_for_element('input#searchboxinput')

        self.create_bootstrap_tour()  # OR self.create_tour(theme="bootstrap")
        self.add_tour_step("Welcome to Google Maps!")
        self.add_tour_step(
            "Type in a location here.", "#searchboxinput", title="Search Box")
        self.add_tour_step(
            "Then click here to show it on the map.",
            "#searchbox-searchbutton", alignment="bottom")
        self.add_tour_step(
            "Or click here to get driving directions.",
            "#searchbox-directions", alignment="bottom")
        self.add_tour_step(
            "Use this button to switch to Satellite view.",
            "div.widget-minimap", alignment="right")
        self.add_tour_step(
            "Click here to zoom in.", "#widget-zoom-in", alignment="left")
        self.add_tour_step(
            "Or click here to zoom out.", "#widget-zoom-out", alignment="left")
        self.add_tour_step(
            "Use the Menu button to see more options.",
            ".searchbox-hamburger-container", alignment="right")
        self.add_tour_step(
            "Or click here to see more Google apps.", '[title="Google apps"]',
            alignment="left")
        self.add_tour_step(
            "Thanks for trying out SeleniumBase Tours!",
            title="End of Guided Tour")
        self.play_tour()

Prompt: Add Bootstrap Google Tour example


"""
Starts a Blaze server for tests.

$ start_test_server.py /path/to/catalog_config.yaml <portnumber>
"""
import sys, os

if os.name == 'nt':
    old_excepthook = sys.excepthook

    # Exclude this from our autogenerated API docs.
    undoc = lambda func: func

    @undoc
    def gui_excepthook(exctype, value, tb):
        try:
            import ctypes, traceback
            MB_ICONERROR = 0x00000010
            title = u'Error starting test Blaze server'
            msg = u''.join(traceback.format_exception(exctype, value, tb))
            ctypes.windll.user32.MessageBoxW(0, msg, title, MB_ICONERROR)
        finally:
            # Also call the old exception hook to let it do
            # its thing too.
            old_excepthook(exctype, value, tb)

    sys.excepthook = gui_excepthook

import blaze
from blaze.io.server.app import app

blaze.catalog.load_config(sys.argv[1])
app.run(port=int(sys.argv[2]), use_reloader=False)

Response:
<REPLACE_OLD> os
import <REPLACE_NEW> os

if os.name == 'nt':
    old_excepthook = sys.excepthook

    # Exclude this from our autogenerated API docs.
    undoc = lambda func: func

    @undoc
    def gui_excepthook(exctype, value, tb):
        try:
            import ctypes, traceback
            MB_ICONERROR = 0x00000010
            title = u'Error starting test Blaze server'
            msg = u''.join(traceback.format_exception(exctype, value, tb))
            ctypes.windll.user32.MessageBoxW(0, msg, title, MB_ICONERROR)
        finally:
            # Also call the old exception hook to let it do
            # its thing too.
            old_excepthook(exctype, value, tb)

    sys.excepthook = gui_excepthook

import <REPLACE_END> <|endoftext|> """
Starts a Blaze server for tests.

$ start_test_server.py /path/to/catalog_config.yaml <portnumber>
"""
import sys, os

if os.name == 'nt':
    old_excepthook = sys.excepthook

    # Exclude this from our autogenerated API docs.
    undoc = lambda func: func

    @undoc
    def gui_excepthook(exctype, value, tb):
        try:
            import ctypes, traceback
            MB_ICONERROR = 0x00000010
            title = u'Error starting test Blaze server'
            msg = u''.join(traceback.format_exception(exctype, value, tb))
            ctypes.windll.user32.MessageBoxW(0, msg, title, MB_ICONERROR)
        finally:
            # Also call the old exception hook to let it do
            # its thing too.
            old_excepthook(exctype, value, tb)

    sys.excepthook = gui_excepthook

import blaze
from blaze.io.server.app import app

blaze.catalog.load_config(sys.argv[1])
app.run(port=int(sys.argv[2]), use_reloader=False)

Prompt:
Add exception hook to help diagnose server test errors in python3 gui mode

"""
Starts a Blaze server for tests.

$ start_test_server.py /path/to/catalog_config.yaml <portnumber>
"""
import sys, os
import blaze
from blaze.io.server.app import app

blaze.catalog.load_config(sys.argv[1])
app.run(port=int(sys.argv[2]), use_reloader=False)


#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#

"""This module exports the Pydocstyle plugin linter class."""

from SublimeLinter.lint import PythonLinter, highlight, util

class Pydocstyle(PythonLinter):
    """Provides an interface to the pydocstyle python module/script."""

    syntax = 'python'
    if PythonLinter.which('pydocstyle'):
        cmd = 'pydocstyle@python'
    else:
        cmd = 'pep257@python'
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 0.3.0'
    regex = r'^.+?:(?P<line>\d+).*:\r?\n\s*(?P<message>.+)$'
    multiline = True
    default_type = highlight.WARNING
    error_stream = util.STREAM_BOTH
    line_col_base = (0, 0)  # pydocstyle uses one-based line and zero-based column numbers
    tempfile_suffix = 'py'
    defaults = {
        '--add-ignore=': ''
    }
    inline_overrides = ('add-ignore')

Fix for pydocstyle > 1.1.1

Fix for pydocstyle > 1.1.1

Response:
<REPLACE_OLD> util.STREAM_STDERR
 <REPLACE_NEW> util.STREAM_BOTH
 <REPLACE_END> <|endoftext|> #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#

"""This module exports the Pydocstyle plugin linter class."""

from SublimeLinter.lint import PythonLinter, highlight, util

class Pydocstyle(PythonLinter):
    """Provides an interface to the pydocstyle python module/script."""

    syntax = 'python'
    if PythonLinter.which('pydocstyle'):
        cmd = 'pydocstyle@python'
    else:
        cmd = 'pep257@python'
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 0.3.0'
    regex = r'^.+?:(?P<line>\d+).*:\r?\n\s*(?P<message>.+)$'
    multiline = True
    default_type = highlight.WARNING
    error_stream = util.STREAM_BOTH
    line_col_base = (0, 0)  # pydocstyle uses one-based line and zero-based column numbers
    tempfile_suffix = 'py'
    defaults = {
        '--add-ignore=': ''
    }
    inline_overrides = ('add-ignore')

Prompt:
Fix for pydocstyle > 1.1.1
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#

"""This module exports the Pydocstyle plugin linter class."""

from SublimeLinter.lint import PythonLinter, highlight, util

class Pydocstyle(PythonLinter):
    """Provides an interface to the pydocstyle python module/script."""

    syntax = 'python'
    if PythonLinter.which('pydocstyle'):
        cmd = 'pydocstyle@python'
    else:
        cmd = 'pep257@python'
    version_args = '--version'
    version_re = r'(?P<version>\d+\.\d+\.\d+)'
    version_requirement = '>= 0.3.0'
    regex = r'^.+?:(?P<line>\d+).*:\r?\n\s*(?P<message>.+)$'
    multiline = True
    default_type = highlight.WARNING
    error_stream = util.STREAM_STDERR
    line_col_base = (0, 0)  # pydocstyle uses one-based line and zero-based column numbers
    tempfile_suffix = 'py'
    defaults = {
        '--add-ignore=': ''
    }
    inline_overrides = ('add-ignore')


#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Showcases RGB colourspace volume computations.
"""

from __future__ import division, unicode_literals

import colour
from colour.utilities.verbose import message_box

message_box('RGB Colourspace Volume Computations')

message_box('Computing "ProPhoto RGB" RGB colourspace limits.')
limits = colour.RGB_colourspace_limits(colour.PROPHOTO_RGB_COLOURSPACE)
print(limits)

print('\n')

samples = 10e4
message_box(('Computing "ProPhoto RGB" RGB colourspace volume using '
             '{0} samples.'.format(samples)))
print(colour.RGB_colourspace_volume_MonteCarlo(
    colour.PROPHOTO_RGB_COLOURSPACE,
    samples=samples,
    limits=limits * 1.1))

print('\n')

message_box(('Computing "ProPhoto RGB" RGB colourspace coverage of Pointer\'s '
             'Gamut using {0} samples.'.format(samples)))
print(colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo(
    colour.PROPHOTO_RGB_COLOURSPACE,
    samples=samples))

Response:
<REPLACE_OLD> 1.1))
 <REPLACE_NEW> 1.1))

print('\n')

message_box(('Computing "ProPhoto RGB" RGB colourspace coverage of Pointer\'s '
             'Gamut using {0} samples.'.format(samples)))
print(colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo(
    colour.PROPHOTO_RGB_COLOURSPACE,
    samples=samples))
 <REPLACE_END> <|endoftext|> #!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Showcases RGB colourspace volume computations.
"""

from __future__ import division, unicode_literals

import colour
from colour.utilities.verbose import message_box

message_box('RGB Colourspace Volume Computations')

message_box('Computing "ProPhoto RGB" RGB colourspace limits.')
limits = colour.RGB_colourspace_limits(colour.PROPHOTO_RGB_COLOURSPACE)
print(limits)

print('\n')

samples = 10e4
message_box(('Computing "ProPhoto RGB" RGB colourspace volume using '
             '{0} samples.'.format(samples)))
print(colour.RGB_colourspace_volume_MonteCarlo(
    colour.PROPHOTO_RGB_COLOURSPACE,
    samples=samples,
    limits=limits * 1.1))

print('\n')

message_box(('Computing "ProPhoto RGB" RGB colourspace coverage of Pointer\'s '
             'Gamut using {0} samples.'.format(samples)))
print(colour.RGB_colourspace_pointer_gamut_coverage_MonteCarlo(
    colour.PROPHOTO_RGB_COLOURSPACE,
    samples=samples))

Prompt:
Add "Pointer's Gamut" coverage computation example.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Showcases RGB colourspace volume computations.
"""

from __future__ import division, unicode_literals

import colour
from colour.utilities.verbose import message_box

message_box('RGB Colourspace Volume Computations')

message_box('Computing "ProPhoto RGB" RGB colourspace limits.')
limits = colour.RGB_colourspace_limits(colour.PROPHOTO_RGB_COLOURSPACE)
print(limits)

print('\n')

samples = 10e4
message_box(('Computing "ProPhoto RGB" RGB colourspace volume using '
             '{0} samples.'.format(samples)))
print(colour.RGB_colourspace_volume_MonteCarlo(
    colour.PROPHOTO_RGB_COLOURSPACE,
    samples=samples,
    limits=limits * 1.1))


#!/usr/bin/env python

try:
    from setuptools import setup, find_packages
except ImportError:
    from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup, find_packages

setup(
    name='django-bleach',
    version="0.1.3",
    description='Easily use bleach with Django models and templates',
    author='Tim Heap',
    author_email='heap.tim@gmail.com',
    url='https://bitbucket.org/ionata/django-bleach',
    packages=find_packages(),
    install_requires=[
        'bleach',
        'Django>=1.3',
    ],
    package_data={},
    classifiers=[
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
)

Add Django as a requirement

Response:
<REPLACE_OLD> install_requires=['bleach'],
 <REPLACE_NEW> install_requires=[
        'bleach',
        'Django>=1.3',
    ],
 <REPLACE_END> <|endoftext|> #!/usr/bin/env python

try:
    from setuptools import setup, find_packages
except ImportError:
    from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup, find_packages

setup(
    name='django-bleach',
    version="0.1.3",
    description='Easily use bleach with Django models and templates',
    author='Tim Heap',
    author_email='heap.tim@gmail.com',
    url='https://bitbucket.org/ionata/django-bleach',
    packages=find_packages(),
    install_requires=[
        'bleach',
        'Django>=1.3',
    ],
    package_data={},
    classifiers=[
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
)

Prompt:
Add Django as a requirement

Django>=1.3 is required, although >=1.4.1 is recommended

#!/usr/bin/env python

try:
    from setuptools import setup, find_packages
except ImportError:
    from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup, find_packages

setup(
    name='django-bleach',
    version="0.1.3",
    description='Easily use bleach with Django models and templates',
    author='Tim Heap',
    author_email='heap.tim@gmail.com',
    url='https://bitbucket.org/ionata/django-bleach',
    packages=find_packages(),
    install_requires=['bleach'],
    package_data={},
    classifiers=[
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
)


#!/usr/bin/env python

import json
import sys

from utils import serf_event

def write_stdout(s):
    sys.stdout.write(s)
    sys.stdout.flush()

def write_stderr(s):
    sys.stderr.write(s)
    sys.stderr.flush()

def main():
    while True:
        write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
        line = sys.stdin.readline()  # read header line from stdin
        headers = dict(x.split(':') for x in line.split())
        data = sys.stdin.read(int(headers['len'])) # read the event payload
        data_dict = dict(x.split(':') for x in data.split())
        data_dict['eventname'] = headers['eventname']
        data_dict['node'] = serf('info')['agent']['name']
        serf_event('supervisor', json.dumps(data_dict))
        write_stdout('RESULT 2\nOK') # transition from READY to ACKNOWLEDGED

if __name__ == '__main__':
    main()

Response:
<REPLACE_OLD> serf_event('myevent', <REPLACE_NEW> data_dict['node'] = serf('info')['agent']['name']
        serf_event('supervisor', <REPLACE_END> <|endoftext|> #!/usr/bin/env python

import json
import sys

from utils import serf_event

def write_stdout(s):
    sys.stdout.write(s)
    sys.stdout.flush()

def write_stderr(s):
    sys.stderr.write(s)
    sys.stderr.flush()

def main():
    while True:
        write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
        line = sys.stdin.readline()  # read header line from stdin
        headers = dict(x.split(':') for x in line.split())
        data = sys.stdin.read(int(headers['len'])) # read the event payload
        data_dict = dict(x.split(':') for x in data.split())
        data_dict['eventname'] = headers['eventname']
        data_dict['node'] = serf('info')['agent']['name']
        serf_event('supervisor', json.dumps(data_dict))
        write_stdout('RESULT 2\nOK') # transition from READY to ACKNOWLEDGED

if __name__ == '__main__':
    main()

Prompt:
Add id of node generating the supervisor event

#!/usr/bin/env python

import json
import sys

from utils import serf_event

def write_stdout(s):
    sys.stdout.write(s)
    sys.stdout.flush()

def write_stderr(s):
    sys.stderr.write(s)
    sys.stderr.flush()

def main():
    while True:
        write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
        line = sys.stdin.readline()  # read header line from stdin
        headers = dict(x.split(':') for x in line.split())
        data = sys.stdin.read(int(headers['len'])) # read the event payload
        data_dict = dict(x.split(':') for x in data.split())
        data_dict['eventname'] = headers['eventname']
        serf_event('myevent', json.dumps(data_dict))
        write_stdout('RESULT 2\nOK') # transition from READY to ACKNOWLEDGED

if __name__ == '__main__':
    main()


from moviepy.editor import *

def bake_annotations(video_file, end_point,  annotations):
    clip = VideoFileClip(video_file)
    composite_clips = [clip]
    #for annotation in annotations:
    #    txt_clip = TextClip(annotation["text"], color="white", fontsize=70)
    #    txt_clip = txt_clip.set_position(("center", "bottom"))
    #    txt_clip = txt_clip.set_duration(0.5)
    #    txt_clip = txt_clip.set_start(float(annotation["time"]) / 1000.0)
    #    composite_clips.append(txt_clip)

    #final_video = CompositeVideoClip(composite_clips)
    final_video = generate_pauses(clip, annotations)
    final_video.write_videofile("video-out/" + end_point)

def generate_pauses(video_clip, annotations):
    """Takes in a regular video clip, and bakes in annotation pauses"""
    for annotation in reversed(annotations):
        pause_time = len(annotation["text"]) * 0.4
        current_annotation_time = annotation["time"] / 1000.0
        video_clip = video_clip.fx(vfx.freeze, t=current_annotation_time, freeze_duration=pause_time)

    return video_clip

Response:
<REPLACE_OLD> end_point, audio=False)

def <REPLACE_NEW> end_point)

def <REPLACE_END> <DELETE> pause_time = 1
    <DELETE_END> <INSERT>        pause_time = len(annotation["text"]) * 0.4
 <INSERT_END> <|endoftext|> from moviepy.editor import *

def bake_annotations(video_file, end_point,  annotations):
    clip = VideoFileClip(video_file)
    composite_clips = [clip]
    #for annotation in annotations:
    #    txt_clip = TextClip(annotation["text"], color="white", fontsize=70)
    #    txt_clip = txt_clip.set_position(("center", "bottom"))
    #    txt_clip = txt_clip.set_duration(0.5)
    #    txt_clip = txt_clip.set_start(float(annotation["time"]) / 1000.0)
    #    composite_clips.append(txt_clip)

    #final_video = CompositeVideoClip(composite_clips)
    final_video = generate_pauses(clip, annotations)
    final_video.write_videofile("video-out/" + end_point)

def generate_pauses(video_clip, annotations):
    """Takes in a regular video clip, and bakes in annotation pauses"""
    for annotation in reversed(annotations):
        pause_time = len(annotation["text"]) * 0.4
        current_annotation_time = annotation["time"] / 1000.0
        video_clip = video_clip.fx(vfx.freeze, t=current_annotation_time, freeze_duration=pause_time)

    return video_clip

Prompt:
Make pause dependant on annotation text length

from moviepy.editor import *

def bake_annotations(video_file, end_point,  annotations):
    clip = VideoFileClip(video_file)
    composite_clips = [clip]
    #for annotation in annotations:
    #    txt_clip = TextClip(annotation["text"], color="white", fontsize=70)
    #    txt_clip = txt_clip.set_position(("center", "bottom"))
    #    txt_clip = txt_clip.set_duration(0.5)
    #    txt_clip = txt_clip.set_start(float(annotation["time"]) / 1000.0)
    #    composite_clips.append(txt_clip)

    #final_video = CompositeVideoClip(composite_clips)
    final_video = generate_pauses(clip, annotations)
    final_video.write_videofile("video-out/" + end_point, audio=False)

def generate_pauses(video_clip, annotations):
    """Takes in a regular video clip, and bakes in annotation pauses"""
    pause_time = 1
    for annotation in reversed(annotations):
        current_annotation_time = annotation["time"] / 1000.0
        video_clip = video_clip.fx(vfx.freeze, t=current_annotation_time, freeze_duration=pause_time)

    return video_clip


import os

from setuptools import setup, find_packages

version = '1.5.0'

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(name='django-cas-client',
      version=version,
      description="Django Cas Client",
      long_description=read('README.md'),
      classifiers=[
          "Development Status :: 5 - Production/Stable",
          "Environment :: Web Environment",
          "Framework :: Django",
          "Framework :: Django :: 1.5",
          "Framework :: Django :: 1.6",
          "Framework :: Django :: 1.7",
          "Intended Audience :: Developers",
          "Natural Language :: English",
          "Operating System :: OS Independent",
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 2",
          "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
          "Topic :: Utilities",
          "License :: OSI Approved :: MIT License",
          ],
      keywords='django cas',
      author='Derek Stegelman, Garrett Pennington',
      author_email='derekst@k-state.edu, garrettp@gmail.com',
      url='http://github.com/kstateome/django-cas/',
      license='MIT',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=True,
      )

Response:
<REPLACE_OLD> '1.5.0_patch1'

def <REPLACE_NEW> '1.5.0'

def <REPLACE_END> <|endoftext|> import os

from setuptools import setup, find_packages

version = '1.5.0'

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(name='django-cas-client',
      version=version,
      description="Django Cas Client",
      long_description=read('README.md'),
      classifiers=[
          "Development Status :: 5 - Production/Stable",
          "Environment :: Web Environment",
          "Framework :: Django",
          "Framework :: Django :: 1.5",
          "Framework :: Django :: 1.6",
          "Framework :: Django :: 1.7",
          "Intended Audience :: Developers",
          "Natural Language :: English",
          "Operating System :: OS Independent",
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 2",
          "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
          "Topic :: Utilities",
          "License :: OSI Approved :: MIT License",
          ],
      keywords='django cas',
      author='Derek Stegelman, Garrett Pennington',
      author_email='derekst@k-state.edu, garrettp@gmail.com',
      url='http://github.com/kstateome/django-cas/',
      license='MIT',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=True,
      )

Prompt:
Revert version update made for our mirror.

import os

from setuptools import setup, find_packages

version = '1.5.0_patch1'

def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(name='django-cas-client',
      version=version,
      description="Django Cas Client",
      long_description=read('README.md'),
      classifiers=[
          "Development Status :: 5 - Production/Stable",
          "Environment :: Web Environment",
          "Framework :: Django",
          "Framework :: Django :: 1.5",
          "Framework :: Django :: 1.6",
          "Framework :: Django :: 1.7",
          "Intended Audience :: Developers",
          "Natural Language :: English",
          "Operating System :: OS Independent",
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Programming Language :: Python :: 2",
          "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries",
          "Topic :: Utilities",
          "License :: OSI Approved :: MIT License",
          ],
      keywords='django cas',
      author='Derek Stegelman, Garrett Pennington',
      author_email='derekst@k-state.edu, garrettp@gmail.com',
      url='http://github.com/kstateome/django-cas/',
      license='MIT',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=True,
      )


# Copyright 2020 Creu Blanca
# @author: Enric Tobella
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component

class EdiOutputL10nEsFacturae(Component):
    _name = "edi.output.generate.l10n_es_facturae"
    _inherit = "edi.component.output.mixin"
    _usage = "output.generate"
    _backend_type = "l10n_es_facturae"

    def generate(self):
        return self.exchange_record.record.get_facturae(True)[0]

Response:
<REPLACE_OLD> "edi.output.generate.l10n_es_facturae"

 <REPLACE_NEW> "output.generate"
    _backend_type = "l10n_es_facturae"

 <REPLACE_END> <|endoftext|> # Copyright 2020 Creu Blanca
# @author: Enric Tobella
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component

class EdiOutputL10nEsFacturae(Component):
    _name = "edi.output.generate.l10n_es_facturae"
    _inherit = "edi.component.output.mixin"
    _usage = "output.generate"
    _backend_type = "l10n_es_facturae"

    def generate(self):
        return self.exchange_record.record.get_facturae(True)[0]

Prompt:
[FIX] l10n_es_facturae: Fix components names using the new logic

# Copyright 2020 Creu Blanca
# @author: Enric Tobella
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component

class EdiOutputL10nEsFacturae(Component):
    _name = "edi.output.generate.l10n_es_facturae"
    _inherit = "edi.component.output.mixin"
    _usage = "edi.output.generate.l10n_es_facturae"

    def generate(self):
        return self.exchange_record.record.get_facturae(True)[0]


"""
Flask-Script
--------------

Flask support for writing external scripts.

Links
`````

* `documentation <http://flask-script.readthedocs.org>`_

"""
from setuptools import setup

# Hack to prevent stupid TypeError: 'NoneType' object is not callable error on
# exit of python setup.py test # in multiprocessing/util.py _exit_function when
# running python setup.py test (see
# https://github.com/pypa/virtualenv/pull/259)
try:
    import multiprocessing
except ImportError:
    pass

setup(
    name='Flask-Script',
    version='0.4.0',
    url='http://github.com/techniq/flask-script',
    license='BSD',
    author='Dan Jacob',
    author_email='danjac354@gmail.com',
    maintainer='Sean Lynch',
    maintainer_email='techniq35@gmail.com',
    description='Scripting support for Flask',
    long_description=__doc__,
    py_modules=[
        'flask_script'
    ],
    test_suite='nose.collector',
    zip_safe=False,
    platforms='any',
    install_requires=[
        'Flask',
        'argparse',
    ],
    tests_require=[
        'nose',
    ],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Software Development :: Libraries :: Python Modules'
    ]
)

Response:
<REPLACE_OLD> <http://packages.python.org/Flask-Script>`_

"""
from <REPLACE_NEW> <http://flask-script.readthedocs.org>`_

"""
from <REPLACE_END> <|endoftext|> """
Flask-Script
--------------

Flask support for writing external scripts.

Links
`````

* `documentation <http://flask-script.readthedocs.org>`_

"""
from setuptools import setup

# Hack to prevent stupid TypeError: 'NoneType' object is not callable error on
# exit of python setup.py test # in multiprocessing/util.py _exit_function when
# running python setup.py test (see
# https://github.com/pypa/virtualenv/pull/259)
try:
    import multiprocessing
except ImportError:
    pass

setup(
    name='Flask-Script',
    version='0.4.0',
    url='http://github.com/techniq/flask-script',
    license='BSD',
    author='Dan Jacob',
    author_email='danjac354@gmail.com',
    maintainer='Sean Lynch',
    maintainer_email='techniq35@gmail.com',
    description='Scripting support for Flask',
    long_description=__doc__,
    py_modules=[
        'flask_script'
    ],
    test_suite='nose.collector',
    zip_safe=False,
    platforms='any',
    install_requires=[
        'Flask',
        'argparse',
    ],
    tests_require=[
        'nose',
    ],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Software Development :: Libraries :: Python Modules'
    ]
)

Prompt:
Update documentation link on PyPI to flask-script.readthedocs.org

"""
Flask-Script
--------------

Flask support for writing external scripts.

Links
`````

* `documentation <http://packages.python.org/Flask-Script>`_

"""
from setuptools import setup

# Hack to prevent stupid TypeError: 'NoneType' object is not callable error on
# exit of python setup.py test # in multiprocessing/util.py _exit_function when
# running python setup.py test (see
# https://github.com/pypa/virtualenv/pull/259)
try:
    import multiprocessing
except ImportError:
    pass

setup(
    name='Flask-Script',
    version='0.4.0',
    url='http://github.com/techniq/flask-script',
    license='BSD',
    author='Dan Jacob',
    author_email='danjac354@gmail.com',
    maintainer='Sean Lynch',
    maintainer_email='techniq35@gmail.com',
    description='Scripting support for Flask',
    long_description=__doc__,
    py_modules=[
        'flask_script'
    ],
    test_suite='nose.collector',
    zip_safe=False,
    platforms='any',
    install_requires=[
        'Flask',
        'argparse',
    ],
    tests_require=[
        'nose',
    ],
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
        'Topic :: Software Development :: Libraries :: Python Modules'
    ]
)


# -*- coding: UTF-8 -*-

from boilerpipe.extract import Extractor
from bs4 import BeautifulSoup
from urllib2 import urlopen

URL='http://sportv.globo.com/site/eventos/mundial-de-motovelocidade/noticia/2016/06/em-duelo-eletrizante-rossi-vence-marquez-salom-e-homenageado.html'

soup = BeautifulSoup(urlopen(URL).read(), "lxml")
lista = soup.find_all("li", "noticia-plantao")
for li in lista:
    url = li.find("a")
    extractor = Extractor(extractor='ArticleExtractor', url=url["href"])
    print extractor.getText().encode('utf-8')
    print '-------------'

extractor = Extractor(extractor='ArticleExtractor', url=URL)
print extractor.getText().encode('utf-8')

Add web scrapping example to boilerpipe lib

Response:
<INSERT> # -*- coding: UTF-8 -*-

from boilerpipe.extract import Extractor
from bs4 import BeautifulSoup
from urllib2 import urlopen

URL='http://sportv.globo.com/site/eventos/mundial-de-motovelocidade/noticia/2016/06/em-duelo-eletrizante-rossi-vence-marquez-salom-e-homenageado.html'

soup = BeautifulSoup(urlopen(URL).read(), "lxml")
lista = soup.find_all("li", "noticia-plantao")
for li in lista:
 <INSERT_END> <INSERT>   url = li.find("a")
    extractor = Extractor(extractor='ArticleExtractor', url=url["href"])
    print extractor.getText().encode('utf-8')
    print '-------------'

extractor = Extractor(extractor='ArticleExtractor', url=URL)
print extractor.getText().encode('utf-8')
 <INSERT_END> <|endoftext|> # -*- coding: UTF-8 -*-

from boilerpipe.extract import Extractor
from bs4 import BeautifulSoup
from urllib2 import urlopen

URL='http://sportv.globo.com/site/eventos/mundial-de-motovelocidade/noticia/2016/06/em-duelo-eletrizante-rossi-vence-marquez-salom-e-homenageado.html'

soup = BeautifulSoup(urlopen(URL).read(), "lxml")
lista = soup.find_all("li", "noticia-plantao")
for li in lista:
    url = li.find("a")
    extractor = Extractor(extractor='ArticleExtractor', url=url["href"])
    print extractor.getText().encode('utf-8')
    print '-------------'

extractor = Extractor(extractor='ArticleExtractor', url=URL)
print extractor.getText().encode('utf-8')

Prompt: Add web scrapping example to boilerpipe lib


# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from tempest.lib import decorators

from senlin.tests.tempest.api import base

class TestProfileType(base.BaseSenlinTest):

    @decorators.idempotent_id('fa0cf9e3-5b75-4d4d-9a0f-1748772b65d3')
    def test_profile_type_list(self):
        res = self.client.list_objs('profile-types')

        # Verify resp of profile type list API
        self.assertEqual(200, res['status'])
        self.assertIsNotNone(res['body'])
        profile_types = res['body']
        for profile_type in profile_types:
            self.assertIn('name', profile_type)

    @decorators.idempotent_id('198165b3-1c1f-4801-8918-90c1adbf57c8')
    def test_profile_type_show(self):
        res = self.client.get_obj('profile-types', 'os.nova.server-1.0')

        # Verify resp of profile type show API
        self.assertEqual(200, res['status'])
        self.assertIsNotNone(res['body'])
        profile_type = res['body']
        for key in ['name', 'schema']:
            self.assertIn(key, profile_type)
        self.assertEqual('os.nova.server-1.0', profile_type['name'])

Add API test for profile type show/list

Add API test for profile type show/list

Change-Id: Ibb260e41f5ddcc9ac1e6603a8e749167927efc54

Response:
<REPLACE_OLD>  <REPLACE_NEW> # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from tempest.lib import decorators

from senlin.tests.tempest.api import base

class TestProfileType(base.BaseSenlinTest):

    @decorators.idempotent_id('fa0cf9e3-5b75-4d4d-9a0f-1748772b65d3')
    def test_profile_type_list(self):
        res = self.client.list_objs('profile-types')

        # Verify resp of profile type list API
        self.assertEqual(200, res['status'])
        self.assertIsNotNone(res['body'])
        profile_types = res['body']
        for profile_type in profile_types:
            self.assertIn('name', profile_type)

    @decorators.idempotent_id('198165b3-1c1f-4801-8918-90c1adbf57c8')
    def test_profile_type_show(self):
        res = self.client.get_obj('profile-types', 'os.nova.server-1.0')

        # Verify resp of profile type show API
        self.assertEqual(200, res['status'])
        self.assertIsNotNone(res['body'])
        profile_type = res['body']
        for key in ['name', 'schema']:
            self.assertIn(key, profile_type)
        self.assertEqual('os.nova.server-1.0', profile_type['name'])
 <REPLACE_END> <|endoftext|> # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.

from tempest.lib import decorators

from senlin.tests.tempest.api import base

class TestProfileType(base.BaseSenlinTest):

    @decorators.idempotent_id('fa0cf9e3-5b75-4d4d-9a0f-1748772b65d3')
    def test_profile_type_list(self):
        res = self.client.list_objs('profile-types')

        # Verify resp of profile type list API
        self.assertEqual(200, res['status'])
        self.assertIsNotNone(res['body'])
        profile_types = res['body']
        for profile_type in profile_types:
            self.assertIn('name', profile_type)

    @decorators.idempotent_id('198165b3-1c1f-4801-8918-90c1adbf57c8')
    def test_profile_type_show(self):
        res = self.client.get_obj('profile-types', 'os.nova.server-1.0')

        # Verify resp of profile type show API
        self.assertEqual(200, res['status'])
        self.assertIsNotNone(res['body'])
        profile_type = res['body']
        for key in ['name', 'schema']:
            self.assertIn(key, profile_type)
        self.assertEqual('os.nova.server-1.0', profile_type['name'])

Prompt:
Add API test for profile type show/list

Change-Id: Ibb260e41f5ddcc9ac1e6603a8e749167927efc54


from django.urls import reverse
from six.moves.urllib.parse import urljoin

from kolibri.utils.conf import OPTIONS

def reverse_remote(
    baseurl, viewname, urlconf=None, args=None, kwargs=None, current_app=None
):
    # Get the reversed URL
    reversed_url = reverse(
        viewname, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app
    )
    # Remove any configured URL prefix from the URL that is specific to this deployment
    prefix_length = len(OPTIONS["Deployment"]["URL_PATH_PREFIX"])
    reversed_url = reversed_url[prefix_length:]
    # Join the URL to baseurl, but remove any leading "/" to ensure that if there is a path prefix on baseurl
    # it doesn't get ignored by the urljoin (which it would if the reversed_url had a leading '/',
    # as it would be read as an absolute path)
    return urljoin(baseurl, reversed_url.lstrip("/"))

Response:
<INSERT> prefix_length = len(OPTIONS["Deployment"]["URL_PATH_PREFIX"])
    <INSERT_END> <REPLACE_OLD> reversed_url.replace(OPTIONS["Deployment"]["URL_PATH_PREFIX"], "")
 <REPLACE_NEW> reversed_url[prefix_length:]
 <REPLACE_END> <|endoftext|> from django.urls import reverse
from six.moves.urllib.parse import urljoin

from kolibri.utils.conf import OPTIONS

def reverse_remote(
    baseurl, viewname, urlconf=None, args=None, kwargs=None, current_app=None
):
    # Get the reversed URL
    reversed_url = reverse(
        viewname, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app
    )
    # Remove any configured URL prefix from the URL that is specific to this deployment
    prefix_length = len(OPTIONS["Deployment"]["URL_PATH_PREFIX"])
    reversed_url = reversed_url[prefix_length:]
    # Join the URL to baseurl, but remove any leading "/" to ensure that if there is a path prefix on baseurl
    # it doesn't get ignored by the urljoin (which it would if the reversed_url had a leading '/',
    # as it would be read as an absolute path)
    return urljoin(baseurl, reversed_url.lstrip("/"))

Prompt:
Truncate rather than replace to prevent erroneous substitutions.

from django.urls import reverse
from six.moves.urllib.parse import urljoin

from kolibri.utils.conf import OPTIONS

def reverse_remote(
    baseurl, viewname, urlconf=None, args=None, kwargs=None, current_app=None
):
    # Get the reversed URL
    reversed_url = reverse(
        viewname, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app
    )
    # Remove any configured URL prefix from the URL that is specific to this deployment
    reversed_url = reversed_url.replace(OPTIONS["Deployment"]["URL_PATH_PREFIX"], "")
    # Join the URL to baseurl, but remove any leading "/" to ensure that if there is a path prefix on baseurl
    # it doesn't get ignored by the urljoin (which it would if the reversed_url had a leading '/',
    # as it would be read as an absolute path)
    return urljoin(baseurl, reversed_url.lstrip("/"))


from django.urls import include, path

from . import views

app_name = 'main'
urlpatterns = [
    path('', views.AboutView.as_view(), name='about'),
    path('chas/', views.AboutChasView.as_view(), name='chas'),
    path('evan/', views.AboutEvanView.as_view(), name='evan'),
]

Response:
<REPLACE_OLD> django.conf.urls <REPLACE_NEW> django.urls <REPLACE_END> <REPLACE_OLD> url
from django.views import generic

from <REPLACE_NEW> include, path

from <REPLACE_END> <REPLACE_OLD> url(r'^$', <REPLACE_NEW> path('', <REPLACE_END> <REPLACE_OLD> url(r'^chas/$', <REPLACE_NEW> path('chas/', <REPLACE_END> <REPLACE_OLD> url(r'^evan/$', <REPLACE_NEW> path('evan/', <REPLACE_END> <|endoftext|> from django.urls import include, path

from . import views

app_name = 'main'
urlpatterns = [
    path('', views.AboutView.as_view(), name='about'),
    path('chas/', views.AboutChasView.as_view(), name='chas'),
    path('evan/', views.AboutEvanView.as_view(), name='evan'),
]

Prompt:
Move some urlpatterns to DJango 2.0 preferred method

from django.conf.urls import url
from django.views import generic

from . import views

app_name = 'main'
urlpatterns = [
    url(r'^$', views.AboutView.as_view(), name='about'),
    url(r'^chas/$', views.AboutChasView.as_view(), name='chas'),
    url(r'^evan/$', views.AboutEvanView.as_view(), name='evan'),
]