From f161c0497c9b2ea9f5eb7c38c5e8b5ceb67f7a88 Mon Sep 17 00:00:00 2001 From: William Woodall Date: Wed, 30 Mar 2016 11:37:34 -0700 Subject: [PATCH] fixup --- rclpy/rclpy/exceptions.py | 6 +++--- rclpy/rclpy/impl/object_proxy.py | 10 +++++----- rclpy/test/talker.py | 2 +- rclpy/test/test_select_rmw_implementation.py | 5 +++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/rclpy/rclpy/exceptions.py b/rclpy/rclpy/exceptions.py index 435b78a32..857c72121 100644 --- a/rclpy/rclpy/exceptions.py +++ b/rclpy/rclpy/exceptions.py @@ -17,18 +17,18 @@ class NotInitializedException(Exception): """Raised when the rclpy implementation is accessed before rclpy.init().""" def __init__(self, *args): - Exception.__init__(self, "rclpy.init() has not been called", *args) + Exception.__init__(self, 'rclpy.init() has not been called', *args) class ImplementationAlreadyImportedException(Exception): """Raised on select_rmw_implemenation() after import_rmw_implementation() has been called.""" def __init__(self, *args): - Exception.__init__(self, "rmw implementation already imported", *args) + Exception.__init__(self, 'rmw implementation already imported', *args) class InvalidRCLPYImplementation(Exception): """Raised when an invalid RCLPYImplementation is requested.""" def __init__(self, *args): - Exception.__init__(self, "requested invalid rmw implementation", *args) + Exception.__init__(self, 'requested invalid rmw implementation', *args) diff --git a/rclpy/rclpy/impl/object_proxy.py b/rclpy/rclpy/impl/object_proxy.py index 27663c43e..d8ca55275 100644 --- a/rclpy/rclpy/impl/object_proxy.py +++ b/rclpy/rclpy/impl/object_proxy.py @@ -76,7 +76,7 @@ def __contains__(self, ob): 'iter', 'oct', 'hex' ]: code_object = compile( - "def __{0}__(self): return {0}(self.__actual__)".format(name), + 'def __{0}__(self): return {0}(self.__actual__)'.format(name), __file__, 'exec', ast.PyCF_ONLY_AST, @@ -86,7 +86,7 @@ def __contains__(self, ob): for name in ['cmp', 'coerce', 'divmod']: code_object = compile( - "def __{0}__(self, ob): return {0}(self.__actual__, ob)".format(name), + 'def __{0}__(self, ob): return {0}(self.__actual__, ob)'.format(name), __file__, 'exec', ast.PyCF_ONLY_AST, @@ -98,7 +98,7 @@ def __contains__(self, ob): ('lt', '<'), ('gt', '>'), ('le', '<='), ('ge', '>='), ('eq', '=='), ('ne', '!=') ]: code_object = compile( - "def __{0}__(self, ob): return self.__actual__ {1} ob".format(name, op), + 'def __{0}__(self, ob): return self.__actual__ {1} ob'.format(name, op), __file__, 'exec', ast.PyCF_ONLY_AST, @@ -108,7 +108,7 @@ def __contains__(self, ob): for name, op in [('neg', '-'), ('pos', '+'), ('invert', '~')]: code_object = compile( - "def __{0}__(self): return {1} self.__actual__".format(name, op), + 'def __{0}__(self): return {1} self.__actual__'.format(name, op), __file__, 'exec', ast.PyCF_ONLY_AST, @@ -159,7 +159,7 @@ def __rpow__(self, ob): class ObjectProxy(AbstractProxy): """Proxy for an internally stored object.""" - __slots__ = "__actual__" + __slots__ = '__actual__' def __init__(self, subject): self.__actual__ = subject diff --git a/rclpy/test/talker.py b/rclpy/test/talker.py index a5203440d..1fb99a276 100644 --- a/rclpy/test/talker.py +++ b/rclpy/test/talker.py @@ -49,5 +49,5 @@ def talker(): except KeyboardInterrupt: print('talker stopped cleanly') except BaseException: - print('exception in talker:') + print('exception in talker:', file=sys.stderr) raise diff --git a/rclpy/test/test_select_rmw_implementation.py b/rclpy/test/test_select_rmw_implementation.py index 6559a8947..3e2747640 100644 --- a/rclpy/test/test_select_rmw_implementation.py +++ b/rclpy/test/test_select_rmw_implementation.py @@ -15,6 +15,7 @@ import ctypes import multiprocessing import os +import sys import traceback # TODO(wjwwood): remove this once we get all the identifiers consistent @@ -28,7 +29,7 @@ def run_catch_report_raise(func, *args, **kwargs): try: return func(*args, **kwargs) except: - print("exception in {0}():".format(func.__name__)) + print('exception in {0}():'.format(func.__name__), file=sys.stderr) traceback.print_exc() raise @@ -102,7 +103,7 @@ def func_select_rmw_implementation_by_environment(rmw_implementation): # (probably use a separate ament index entry). return ctypes.c_bool(True) print("Failed to import rmw implementation '{0}', ignoring." - .format(rmw_implementation)) + .format(rmw_implementation), file=sys.stderr) raise set_rmw = rclpy.get_implementation_identifier()