prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  `SnippetEvent` should be loggable
  Right now logging event object directly does not show the content of the event, which makes debugging difficult.
  `logging.info(event)` should log the full content of the event.
  
  </issue>
  <code>
  [start of setup.py]
  1 # Copyright 2016 Google Inc.
  2 # 
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 # 
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 # 
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import platform
  16 import setuptools
  17 from setuptools.command import test
  18 import sys
  19 
  20 install_requires = [
  21     'future',
  22     # mock-1.0.1 is the last version compatible with setuptools <17.1,
  23     # which is what comes with Ubuntu 14.04 LTS.
  24     'mock<=1.0.1',
  25     'portpicker',
  26     'psutil',
  27     'pytz',
  28     'pyyaml',
  29     'timeout_decorator',
  30     'pyserial'
  31 ]
  32 
  33 if sys.version_info < (3, ):
  34     install_requires.extend([
  35         'enum34',
  36         # "futures" is needed for py2 compatibility and it only works in 2.7
  37         'futures',
  38     ])
  39 
  40 if platform.system() == 'Windows':
  41     install_requires.append('pywin32')
  42 
  43 
  44 class PyTest(test.test):
  45     """Class used to execute unit tests using PyTest. This allows us to execute
  46     unit tests without having to install the package.
  47     """
  48 
  49     def finalize_options(self):
  50         test.test.finalize_options(self)
  51         self.test_args = ['-x', "tests"]
  52         self.test_suite = True
  53 
  54     def run_tests(self):
  55         import pytest
  56         errno = pytest.main(self.test_args)
  57         sys.exit(errno)
  58 
  59 
  60 def main():
  61     setuptools.setup(
  62         name='mobly',
  63         version='1.7.1',
  64         maintainer = 'Ang Li',
  65         maintainer_email = 'mobly-github@googlegroups.com',
  66         description='Automation framework for special end-to-end test cases',
  67         license='Apache2.0',
  68         url = 'https://github.com/google/mobly',
  69         download_url = 'https://github.com/google/mobly/tarball/1.7.1',
  70         packages=setuptools.find_packages(),
  71         include_package_data=False,
  72         scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],
  73         tests_require=['pytest'],
  74         install_requires=install_requires,
  75         cmdclass={'test': PyTest}, )
  76 
  77 
  78 if __name__ == '__main__':
  79     main()
  80
  [end of setup.py]
  [start of mobly/controllers/android_device_lib/snippet_event.py]
  1 # Copyright 2017 Google Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 # 
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 # 
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 
  16 def from_dict(event_dict):
  17     """Create a SnippetEvent object from a dictionary.
  18 
  19     Args:
  20         event_dict: a dictionary representing an event.
  21 
  22     Returns:
  23         A SnippetEvent object.
  24     """
  25     return SnippetEvent(
  26         callback_id=event_dict['callbackId'],
  27         name=event_dict['name'],
  28         creation_time=event_dict['time'],
  29         data=event_dict['data'])
  30 
  31 
  32 class SnippetEvent(object):
  33     """The class that represents callback events for mobly snippet library.
  34 
  35     Attributes:
  36         callback_id: string, the callback ID associated with the event.
  37         name: string, the name of the event.
  38         creation_time: int, the epoch time when the event is created on the
  39             Rpc server side.
  40         data: dictionary, the data held by the event. Can be None.
  41     """
  42 
  43     def __init__(self, callback_id, name, creation_time, data):
  44         self.callback_id = callback_id
  45         self.name = name
  46         self.creation_time = creation_time
  47         self.data = data
  48
  [end of mobly/controllers/android_device_lib/snippet_event.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mobly/controllers/android_device_lib/snippet_event.py b/mobly/controllers/android_device_lib/snippet_event.py
  --- a/mobly/controllers/android_device_lib/snippet_event.py
  +++ b/mobly/controllers/android_device_lib/snippet_event.py
  @@ -3,9 +3,9 @@
   # 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.
  @@ -45,3 +45,8 @@
           self.name = name
           self.creation_time = creation_time
           self.data = data
  +
  +    def __repr__(self):
  +        return ('SnippetEvent(callback_id: %s, name: %s, creation_time: %s, '
  +                'data: %s)') % (self.callback_id, self.name,
  +                                self.creation_time, self.data)
  diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -70,7 +70,7 @@
           packages=setuptools.find_packages(),
           include_package_data=False,
           scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],
  -        tests_require=['pytest'],
  +        tests_require=['pytest', 'testfixtures'],
           install_requires=install_requires,
           cmdclass={'test': PyTest}, )
  
verification_info: {"golden_diff": "diff --git a/mobly/controllers/android_device_lib/snippet_event.py b/mobly/controllers/android_device_lib/snippet_event.py\n--- a/mobly/controllers/android_device_lib/snippet_event.py\n+++ b/mobly/controllers/android_device_lib/snippet_event.py\n@@ -3,9 +3,9 @@\n # Licensed under the Apache License, Version 2.0 (the \"License\");\n # you may not use this file except in compliance with the License.\n # You may obtain a copy of the License at\n-# \n+#\n #     http://www.apache.org/licenses/LICENSE-2.0\n-# \n+#\n # Unless required by applicable law or agreed to in writing, software\n # distributed under the License is distributed on an \"AS IS\" BASIS,\n # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n@@ -45,3 +45,8 @@\n         self.name = name\n         self.creation_time = creation_time\n         self.data = data\n+\n+    def __repr__(self):\n+        return ('SnippetEvent(callback_id: %s, name: %s, creation_time: %s, '\n+                'data: %s)') % (self.callback_id, self.name,\n+                                self.creation_time, self.data)\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -70,7 +70,7 @@\n         packages=setuptools.find_packages(),\n         include_package_data=False,\n         scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],\n-        tests_require=['pytest'],\n+        tests_require=['pytest', 'testfixtures'],\n         install_requires=install_requires,\n         cmdclass={'test': PyTest}, )\n", "issue": "`SnippetEvent` should be loggable\nRight now logging event object directly does not show the content of the event, which makes debugging difficult.\r\n`logging.info(event)` should log the full content of the event.\n", "before_files": [{"content": "# Copyright 2016 Google Inc.\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n#     http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport platform\nimport setuptools\nfrom setuptools.command import test\nimport sys\n\ninstall_requires = [\n    'future',\n    # mock-1.0.1 is the last version compatible with setuptools <17.1,\n    # which is what comes with Ubuntu 14.04 LTS.\n    'mock<=1.0.1',\n    'portpicker',\n    'psutil',\n    'pytz',\n    'pyyaml',\n    'timeout_decorator',\n    'pyserial'\n]\n\nif sys.version_info < (3, ):\n    install_requires.extend([\n        'enum34',\n        # \"futures\" is needed for py2 compatibility and it only works in 2.7\n        'futures',\n    ])\n\nif platform.system() == 'Windows':\n    install_requires.append('pywin32')\n\n\nclass PyTest(test.test):\n    \"\"\"Class used to execute unit tests using PyTest. This allows us to execute\n    unit tests without having to install the package.\n    \"\"\"\n\n    def finalize_options(self):\n        test.test.finalize_options(self)\n        self.test_args = ['-x', \"tests\"]\n        self.test_suite = True\n\n    def run_tests(self):\n        import pytest\n        errno = pytest.main(self.test_args)\n        sys.exit(errno)\n\n\ndef main():\n    setuptools.setup(\n        name='mobly',\n        version='1.7.1',\n        maintainer = 'Ang Li',\n        maintainer_email = 'mobly-github@googlegroups.com',\n        description='Automation framework for special end-to-end test cases',\n        license='Apache2.0',\n        url = 'https://github.com/google/mobly',\n        download_url = 'https://github.com/google/mobly/tarball/1.7.1',\n        packages=setuptools.find_packages(),\n        include_package_data=False,\n        scripts=['tools/sl4a_shell.py', 'tools/snippet_shell.py'],\n        tests_require=['pytest'],\n        install_requires=install_requires,\n        cmdclass={'test': PyTest}, )\n\n\nif __name__ == '__main__':\n    main()\n", "path": "setup.py"}, {"content": "# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n#     http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\ndef from_dict(event_dict):\n    \"\"\"Create a SnippetEvent object from a dictionary.\n\n    Args:\n        event_dict: a dictionary representing an event.\n\n    Returns:\n        A SnippetEvent object.\n    \"\"\"\n    return SnippetEvent(\n        callback_id=event_dict['callbackId'],\n        name=event_dict['name'],\n        creation_time=event_dict['time'],\n        data=event_dict['data'])\n\n\nclass SnippetEvent(object):\n    \"\"\"The class that represents callback events for mobly snippet library.\n\n    Attributes:\n        callback_id: string, the callback ID associated with the event.\n        name: string, the name of the event.\n        creation_time: int, the epoch time when the event is created on the\n            Rpc server side.\n        data: dictionary, the data held by the event. Can be None.\n    \"\"\"\n\n    def __init__(self, callback_id, name, creation_time, data):\n        self.callback_id = callback_id\n        self.name = name\n        self.creation_time = creation_time\n        self.data = data\n", "path": "mobly/controllers/android_device_lib/snippet_event.py"}]}