<86>Jul 25 08:07:18 userdel[353422]: delete user 'rooter' <86>Jul 25 08:07:18 userdel[353422]: removed group 'rooter' owned by 'rooter' <86>Jul 25 08:07:18 groupadd[353429]: group added to /etc/group: name=rooter, GID=573 <86>Jul 25 08:07:18 groupadd[353429]: group added to /etc/gshadow: name=rooter <86>Jul 25 08:07:18 groupadd[353429]: new group: name=rooter, GID=573 <86>Jul 25 08:07:18 useradd[353439]: new user: name=rooter, UID=573, GID=573, home=/root, shell=/bin/bash <86>Jul 25 08:07:18 userdel[353450]: delete user 'builder' <86>Jul 25 08:07:18 userdel[353450]: removed group 'builder' owned by 'builder' <86>Jul 25 08:07:18 userdel[353450]: removed shadow group 'builder' owned by 'builder' <86>Jul 25 08:07:18 groupadd[353458]: group added to /etc/group: name=builder, GID=574 <86>Jul 25 08:07:18 groupadd[353458]: group added to /etc/gshadow: name=builder <86>Jul 25 08:07:18 groupadd[353458]: new group: name=builder, GID=574 <86>Jul 25 08:07:18 useradd[353468]: new user: name=builder, UID=574, GID=574, home=/usr/src, shell=/bin/bash <13>Jul 25 08:07:20 rpmi: libgdbm-1.8.3-alt10 1454943334 installed <13>Jul 25 08:07:20 rpmi: libexpat-2.2.9-alt1 sisyphus+252464.200.2.1 1590958865 installed <13>Jul 25 08:07:20 rpmi: libp11-kit-0.23.15-alt2 sisyphus+252784.100.2.2 1591274901 installed <13>Jul 25 08:07:20 rpmi: libtasn1-4.16.0-alt1 sisyphus+245480.100.1.1 1580825062 installed <13>Jul 25 08:07:20 rpmi: rpm-macros-alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Jul 25 08:07:20 rpmi: alternatives-0.5.1-alt1 sisyphus+226946.100.1.1 1554830426 installed <13>Jul 25 08:07:20 rpmi: ca-certificates-2020.06.29-alt1 sisyphus+254237.300.1.1 1593450881 installed <13>Jul 25 08:07:20 rpmi: ca-trust-0.1.2-alt1 sisyphus+233348.100.1.1 1561653823 installed <13>Jul 25 08:07:20 rpmi: p11-kit-trust-0.23.15-alt2 sisyphus+252784.100.2.2 1591274901 installed <13>Jul 25 08:07:20 rpmi: libcrypto1.1-1.1.1g-alt1 sisyphus+249982.60.8.1 1587743711 installed <13>Jul 25 08:07:20 rpmi: libssl1.1-1.1.1g-alt1 sisyphus+249982.60.8.1 1587743711 installed <13>Jul 25 08:07:20 rpmi: python3-3.8.5-alt1 sisyphus+244405.100.3.1 1595544514 installed <13>Jul 25 08:07:21 rpmi: python3-base-3.8.5-alt1 sisyphus+244405.100.3.1 1595544514 installed <13>Jul 25 08:07:21 rpmi: libpython3-3.8.5-alt1 sisyphus+244405.100.3.1 1595544514 installed <13>Jul 25 08:07:21 rpmi: tests-for-installed-python3-pkgs-0.1.13.1-alt2 1535450458 installed <13>Jul 25 08:07:21 rpmi: rpm-build-python3-0.1.13.1-alt2 1535450458 installed <13>Jul 25 08:07:24 rpmi: libverto-0.3.0-alt1_7 sisyphus+225932.100.1.1 1553994919 installed <13>Jul 25 08:07:24 rpmi: liblmdb-0.9.23-alt1 sisyphus+225277.100.2.1 1553001679 installed <13>Jul 25 08:07:24 rpmi: libkeyutils-1.6-alt2 sisyphus+226520.100.2.1 1554512089 installed <13>Jul 25 08:07:24 rpmi: libffi6-1:3.2.1-alt4 sisyphus+251953.300.2.1 1589891360 installed <13>Jul 25 08:07:24 rpmi: libcom_err-1.44.6-alt1 sisyphus+224154.100.1.1 1552091678 installed <86>Jul 25 08:07:24 groupadd[362381]: group added to /etc/group: name=_keytab, GID=499 <86>Jul 25 08:07:24 groupadd[362381]: group added to /etc/gshadow: name=_keytab <86>Jul 25 08:07:24 groupadd[362381]: new group: name=_keytab, GID=499 <13>Jul 25 08:07:24 rpmi: libkrb5-1.18.2-alt2 sisyphus+254565.100.4.1 1594375666 installed <13>Jul 25 08:07:24 rpmi: libtirpc-1.2.6-alt1 sisyphus+250076.100.1.1 1587038270 installed <13>Jul 25 08:07:24 rpmi: libnsl2-1.1.0-alt1_1 1511548749 installed <13>Jul 25 08:07:24 rpmi: python-modules-encodings-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-compiler-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-email-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-unittest-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-nis-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-ctypes-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-multiprocessing-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-modules-logging-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed <13>Jul 25 08:07:24 rpmi: python-tools-2to3-2.7.18-alt1 sisyphus+250345.100.4.1 1588665080 installed Building target platforms: i586 Building for target i586 Wrote: /usr/src/in/nosrpm/python3-module-protobuf-socket-rpc-1.3.1-alt3.nosrc.rpm <13>Jul 25 08:07:26 rpmi: python3-module-pkg_resources-1:46.1.3-alt1 sisyphus+250566.200.3.1 1587973342 installed <13>Jul 25 08:07:26 rpmi: libtinfo-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Jul 25 08:07:27 rpmi: libncurses-devel-6.1.20180407-alt2 sisyphus+222164.200.1.1 1550686226 installed <13>Jul 25 08:07:27 rpmi: python3-dev-3.8.5-alt1 sisyphus+244405.100.3.1 1595544514 installed <13>Jul 25 08:07:27 rpmi: python3-module-setuptools-1:46.1.3-alt1 sisyphus+250566.200.3.1 1587973342 installed Installing python3-module-protobuf-socket-rpc-1.3.1-alt3.src.rpm Building target platforms: i586 Building for target i586 Executing(%prep): /bin/sh -e /usr/src/tmp/rpm-tmp.31382 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + rm -rf python3-module-protobuf-socket-rpc-1.3.1 + echo 'Source #0 (python3-module-protobuf-socket-rpc-1.3.1.tar):' Source #0 (python3-module-protobuf-socket-rpc-1.3.1.tar): + /bin/tar -xf /usr/src/RPM/SOURCES/python3-module-protobuf-socket-rpc-1.3.1.tar + cd python3-module-protobuf-socket-rpc-1.3.1 + /bin/chmod -c -Rf u+rwX,go-w . + cp proto/rpc.proto python/src/protobuf/socketrpc/ + find ./ -type f -name '*.py' -exec 2to3 -w -n '{}' + RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored ./src/test/protobuf/test_pb2.py RefactoringTool: Refactored ./src/test/protobuf/service_test.py --- ./src/test/protobuf/test_pb2.py (original) +++ ./src/test/protobuf/test_pb2.py (refactored) @@ -38,7 +38,7 @@ descriptor.FieldDescriptor( name='str_data', full_name='protobuf.socketrpc.Request.str_data', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -60,7 +60,7 @@ descriptor.FieldDescriptor( name='str_data', full_name='protobuf.socketrpc.Response.str_data', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -81,12 +81,10 @@ -class Request(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Request(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _REQUEST -class Response(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Response(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _RESPONSE @@ -107,10 +105,8 @@ ), ]) -class TestService(service.Service): - __metaclass__ = service_reflection.GeneratedServiceType +class TestService(service.Service, metaclass=service_reflection.GeneratedServiceType): DESCRIPTOR = _TESTSERVICE -class TestService_Stub(TestService): - __metaclass__ = service_reflection.GeneratedServiceStubType +class TestService_Stub(TestService, metaclass=service_reflection.GeneratedServiceStubType): DESCRIPTOR = _TESTSERVICE --- ./src/test/protobuf/service_test.py (original) +++ ./src/test/protobuf/service_test.py (refactored) @@ -40,11 +40,11 @@ from protobuf.error import RpcError from protobuf.channel import SocketRpcChannel import protobuf.server as server -import fake +from . import fake # Import the protoc generated test module import protobuf.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 port = 63636 host = 'localhost' @@ -152,17 +152,17 @@ callback.condition.acquire() try: self.service.TestMethod(self.request, callback=callback) - except Exception, e: + except Exception as e: traceback.print_exc() - self.assert_(False, 'Caught an unexpected exception %s' % e) + self.assertTrue(False, 'Caught an unexpected exception %s' % e) callback.condition.wait(2.0) - self.assertEquals(True, callback.called, + self.assertEqual(True, callback.called, 'Asynch callback was not called') # Cannot compare response to None because of bug in protobuf msg compare code - self.assert_(type(callback.response) != None.__class__, + self.assertTrue(type(callback.response) != None.__class__, 'Callback response was None') @@ -171,19 +171,19 @@ TestRpcService.callback_method_condition.acquire() try: self.service.TestMethod(self.request, callback=TestRpcService.callback) - except Exception, e: + except Exception as e: traceback.print_exc() self.fail('Caught an unexpected exception %s' % e) TestRpcService.callback_method_condition.wait(2.0) - self.assertEquals(True, TestRpcService.callback_method_called, + self.assertEqual(True, TestRpcService.callback_method_called, 'Asynch callback was not called') - self.assertEquals(self.request, TestRpcService.callback_method_request, + self.assertEqual(self.request, TestRpcService.callback_method_request, 'Asynch callback request arg not equal to request') # Cannot compare reposne to None because of bug in protobuf msg RefactoringTool: Refactored ./src/test/protobuf/server_test.py RefactoringTool: Refactored ./src/test/protobuf/run_tests.py RefactoringTool: Refactored ./src/test/protobuf/fake.py RefactoringTool: No changes to ./src/test/protobuf/error_test.py RefactoringTool: Refactored ./src/test/protobuf/controller_test.py RefactoringTool: Refactored ./src/test/protobuf/channel_test.py compare code - self.assert_(type(TestRpcService.callback_method_response) != None.__class__, + self.assertTrue(type(TestRpcService.callback_method_response) != None.__class__, 'Callback response was None') def test_call_synch(self): @@ -191,7 +191,7 @@ try: response = self.service.TestMethod(self.request, timeout=1000) - except Exception, e: + except Exception as e: self.fail('Caught an unexpected exception %s' % e) self.assertNotEqual(type(response) != None.__class__, 'Callback response was None') @@ -250,8 +250,8 @@ try: self.thread.run() - except Exception, e: - self.assert_(False, "TestRpcThread.run() threw and exception", e) + except Exception as e: + self.assertTrue(False, "TestRpcThread.run() threw and exception", e) def suite(): '''Returns a test suite containing all module tests''' --- ./src/test/protobuf/server_test.py (original) +++ ./src/test/protobuf/server_test.py (refactored) @@ -42,8 +42,8 @@ import protobuf.error as error # Test imports (relative imports) -from fake import FakeSocketFactory, TestServiceImpl -import test_pb2 +from .fake import FakeSocketFactory, TestServiceImpl +from . import test_pb2 @@ -156,7 +156,7 @@ response = handler.callMethod(service, method, self.service_request) - self.assertEquals(response, expected_rpc,'Normal response') + self.assertEqual(response, expected_rpc,'Normal response') def test_callMethod_RPC_FAILED(self): @@ -178,9 +178,9 @@ response = handler.callMethod(service, method, self.service_request) - self.assertEquals(response.error_reason,rpc_pb2.RPC_FAILED, + self.assertEqual(response.error_reason,rpc_pb2.RPC_FAILED, 'RPC_FAILED - error code') - self.assertEquals(response.error,failmsg,'RPC_FAILED - messsage') + self.assertEqual(response.error,failmsg,'RPC_FAILED - messsage') def test_callMethod_RPC_ERROR(self): --- ./src/test/protobuf/run_tests.py (original) +++ ./src/test/protobuf/run_tests.py (refactored) @@ -31,11 +31,11 @@ import unittest # Module imports -import channel_test -import controller_test -import error_test -import server_test -import service_test +from . import channel_test +from . import controller_test +from . import error_test +from . import server_test +from . import service_test if __name__ == '__main__': suite = unittest.TestSuite() --- ./src/test/protobuf/fake.py (original) +++ ./src/test/protobuf/fake.py (refactored) @@ -33,7 +33,7 @@ # Module imports import protobuf.channel as ch import protobuf.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 @@ -122,7 +122,8 @@ self.ioerror = False - def connect(self,(host,port)): + def connect(self, xxx_todo_changeme): + (host,port) = xxx_todo_changeme if self.unknownhost: raise socket.gaierror() --- ./src/test/protobuf/controller_test.py (original) +++ ./src/test/protobuf/controller_test.py (refactored) @@ -39,11 +39,11 @@ import protobuf.controller as controller # Import the fake stub classes used in testing to simulate sockets etc. -from fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl +from .fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl # Import the RPC definition class and the test service class import protobuf.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 --- ./src/test/protobuf/channel_test.py (original) +++ ./src/test/protobuf/channel_test.py (refactored) @@ -38,11 +38,11 @@ import protobuf.error as error # Import the fake stub classes used in testing to simulate sockets etc. -from fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl +from .fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl # Import the RPC definition class and the test service class import protobuf.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 @@ -80,8 +80,8 @@ def test___init__defaults(self): - self.assert_(self.channel.host, True) - self.assert_(self.channel.port, True) + self.assertTrue(self.channel.host, True) + self.assertTrue(self.channel.port, True) def test_validateRequest(self): @@ -104,7 +104,7 @@ def test_openSocket(self): '''Test normal return from openSocket.''' - self.assert_(self.channel.openSocket, "openSocket returns something") + self.assertTrue(self.channel.openSocket, "openSocket returns something") def test_openSocket_IO_ERROR(self): @@ -121,7 +121,7 @@ def test_openSocket_UNKNOWN_HOST(self): '''Test exceptional return from openSocket (UNKNOWN_HOST).''' - self.assert_(self.channel.openSocket, "openSocket returns something") + self.assertTrue(self.channel.openSocket, "openSocket returns something") # Fake socket primed to throw an unknown host exception socket = FakeSocket() @@ -260,14 +260,14 @@ service.TestMethod(controller,self.service_request,callback) self.assertTrue(callback.invoked,'Callback invoked') - self.assertEquals(self.service_response.str_data, + self.assertEqual(self.service_response.str_data, callback.response.str_data,'Response message') - self.assertEquals(self.serialized_request, + self.assertEqual(self.serialized_request, socket.getRequest().request_proto, 'Request protocol serialisation') - self.assertEquals(service.DESCRIPTOR.full_name, + self.assertEqual(service.DESCRIPTOR.full_name, socket.getRequest().service_name,'Service name') - self.assertEquals(service.DESCRIPTOR.methods[0].name, + self.assertEqual(service.DESCRIPTOR.methods[0].name, socket.getRequest().method_name,'Method name') @@ -293,7 +293,7 @@ self.assertFalse(callback.invoked,'Callback invoked') self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.UNKNOWN_HOST,controller.reason, + self.assertEqual(rpc_pb2.UNKNOWN_HOST,controller.reason, 'Error reason') def testIOErrorWhileCreatingSocket(self): @@ -318,7 +318,7 @@ self.assertFalse(callback.invoked,'Callback invoked') self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.IO_ERROR,controller.reason,'Error reason') + self.assertEqual(rpc_pb2.IO_ERROR,controller.reason,'Error reason') def testIncompleteRequest(self): @@ -345,7 +345,7 @@ service.TestMethod(controller,service_request,callback) self.assertFalse(callback.invoked,'Callback invoked') - self.assertEquals(rpc_pb2.BAD_REQUEST_PROTO,controller.reason) + self.assertEqual(rpc_pb2.BAD_REQUEST_PROTO,controller.reason) self.assertTrue(controller.failed()) @@ -370,12 +370,12 @@ service.TestMethod(controller,self.service_request,callback) self.assertFalse(callback.invoked,'Callback invoked') - self.assertEquals(self.serialized_request, + self.assertEqual(self.serialized_request, socket.getRequest().request_proto, 'Request protocol serialisation') - self.assertEquals(service.DESCRIPTOR.full_name, + self.assertEqual(service.DESCRIPTOR.full_name, socket.getRequest().service_name,'Service name') - self.assertEquals(service.DESCRIPTOR.methods[0].name, + self.assertEqual(service.DESCRIPTOR.methods[0].name, socket.getRequest().method_name,'Method name') @@ -401,11 +401,11 @@ # Verify request was sent and bad response received self.assertFalse(callback.invoked,'Callback invoked') - self.assertEquals(self.serialized_request, + self.assertEqual(self.serialized_request, socket.getRequest().request_proto, 'Request protocol serialisation') self.assertTrue(controller.failed(),'Controller failed') - self.assertEquals(rpc_pb2.BAD_RESPONSE_PROTO, controller.reason, + self.assertEqual(rpc_pb2.BAD_RESPONSE_PROTO, controller.reason, 'Controller reason') @@ -464,7 +464,7 @@ def test_tryToValidateRequest(self): '''Test tryToValidateRequest - normal usage.''' - self.assertEquals(self.lc.tryToValidateRequest(self.rpc_request), + self.assertEqual(self.lc.tryToValidateRequest(self.rpc_request), None, "tryToValidateRequest - valid request") @@ -473,7 +473,7 @@ self.controller.success = False - self.assertEquals(self.lc.tryToValidateRequest(self.rpc_request), + self.assertEqual(self.lc.tryToValidateRequest(self.rpc_request), None, "tryToValidateRequest - controller in error state") @@ -485,10 +485,10 @@ self.lc.tryToValidateRequest(self.rpc_request) - self.assertEquals(self.controller.reason, rpc_pb2.BAD_REQUEST_PROTO, + self.assertEqual(self.controller.reason, rpc_pb2.BAD_REQUEST_PROTO, "tryToValidateRequest - invalid request") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToValidateRequest - invalid request") @@ -496,7 +496,7 @@ '''Test tryToOpenSocket - normal usage.''' self.lc.tryToOpenSocket() - self.assert_(self.lc.sock) + self.assertTrue(self.lc.sock) def test_tryToOpenSocket_con_error(self): @@ -504,7 +504,7 @@ self.controller.error = True self.lc.tryToOpenSocket() - self.assertEquals(self.lc.sock, None, + self.assertEqual(self.lc.sock, None, "tryToOpenSocket - controller in error state") @@ -514,13 +514,13 @@ self.socket.throwUnknownHostException() self.lc.tryToOpenSocket() - self.assertEquals(self.lc.sock, None, + self.assertEqual(self.lc.sock, None, "tryToOpenSocket - UNKNOWN_HOST error") - self.assertEquals(self.controller.reason, rpc_pb2.UNKNOWN_HOST, + self.assertEqual(self.controller.reason, rpc_pb2.UNKNOWN_HOST, "tryToOpenSocket - UNKNOWN_HOST error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToOpenSocket - UNKNOWN_HOST error") @@ -530,13 +530,13 @@ self.socket.throwIOErrorException() self.lc.tryToOpenSocket() - self.assertEquals(self.lc.sock, None, + self.assertEqual(self.lc.sock, None, "tryToOpenSocket - IO_ERROR error") - self.assertEquals(self.controller.reason, rpc_pb2.IO_ERROR, + self.assertEqual(self.controller.reason, rpc_pb2.IO_ERROR, "tryToOpenSocket - IO_ERROR error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToOpenSocket - IO_ERROR error") @@ -555,7 +555,7 @@ # Add the socket instance to the lifecycle object self.lc.sock = self.socket - self.assertEquals(self.lc.tryToSendRpcRequest(method, self.rpc_request), + self.assertEqual(self.lc.tryToSendRpcRequest(method, self.rpc_request), None, "tryToSendRpcRequest - normal return") @@ -575,13 +575,13 @@ self.socket.throwIOErrorException() self.lc.sock = self.socket - self.assertEquals(self.lc.tryToSendRpcRequest(method, self.rpc_requesRefactoringTool: Refactored ./src/main/protobuf/service.py t), + self.assertEqual(self.lc.tryToSendRpcRequest(method, self.rpc_request), None, "tryToSendRpcRequest - IO_ERROR") - self.assertEquals(self.controller.reason, rpc_pb2.IO_ERROR, + self.assertEqual(self.controller.reason, rpc_pb2.IO_ERROR, "tryToSendRpcRequest - IO_ERROR error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToSendRpcRequest - IO_ERROR error") @@ -593,11 +593,11 @@ self.socket.withInputBytes(msg) self.lc.sock = self.socket - self.assertEquals(self.lc.tryToReceiveReply(), None, + self.assertEqual(self.lc.tryToReceiveReply(), None, "tryToReceiveReply - normal usage") # Verify the socket has been closed - self.assert_(self.socket.input_stream.closed, + self.assertTrue(self.socket.input_stream.closed, "tryToReceiveReply - normal usage") @@ -610,17 +610,17 @@ self.socket.throwIOErrorException() self.lc.sock = self.socket - self.assertEquals(self.lc.tryToReceiveReply(), None, + self.assertEqual(self.lc.tryToReceiveReply(), None, "tryToReceiveReply - IO_ERROR error") - self.assertEquals(self.controller.reason, rpc_pb2.IO_ERROR, + self.assertEqual(self.controller.reason, rpc_pb2.IO_ERROR, "tryToReceiveReply - IO_ERROR error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToReceiveReply - IO_ERROR error") # Verify the socket has been closed - self.assert_(self.socket.input_stream.closed, + self.assertTrue(self.socket.input_stream.closed, "tryToReceiveReply - IO_ERROR error") @@ -631,7 +631,7 @@ expected_response = resp_class() self.lc.byte_stream = expected_response.SerializeToString() - self.assertEquals(self.lc.tryToParseReply(), None, + self.assertEqual(self.lc.tryToParseReply(), None, "tryToParseReply - normal usage") @@ -641,13 +641,13 @@ # Setup an arbitrary and broken bytestream self.lc.byte_stream = 'ABCD' - self.assertEquals(self.lc.tryToParseReply(), None, + self.assertEqual(self.lc.tryToParseReply(), None, "tryToParseReply - BAD_RESPONSE_PROTO error") - self.assertEquals(self.controller.reason, rpc_pb2.BAD_RESPONSE_PROTO, + self.assertEqual(self.controller.reason, rpc_pb2.BAD_RESPONSE_PROTO, "tryToParseReply - BAD_RESPONSE_PROTO error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToParseReply - BAD_RESPONSE_PROTO error") @@ -660,7 +660,7 @@ self.lc.byte_stream = expected_response.SerializeToString() self.lc.rpcResponse = expected_response - self.assertEquals(self.lc.tryToRetrieveServiceResponse(resp_class), + self.assertEqual(self.lc.tryToRetrieveServiceResponse(resp_class), None, "tryToRetrieveServiceResponse - normal usage") @@ -679,10 +679,10 @@ callback = FakeCallback() self.lc.rpcResponse = rpc_pb2.Response() - self.assertEquals(self.lc.tryToRunCallback(callback), None, + self.assertEqual(self.lc.tryToRunCallback(callback), None, "tryToRunCallback - normal usage") - self.assert_(self.controller.success, + self.assertTrue(self.controller.success, "tryToRunCallback - contoller success flag set") --- ./src/main/protobuf/service.py (original) +++ ./src/main/protobuf/service.py (refactored) @@ -155,8 +155,8 @@ else: if ((not callable(callback) and (callback.__class__.__dRefactoringTool: Refactored ./src/main/protobuf/server.py RefactoringTool: Refactored ./src/main/protobuf/rpc_pb2.py ict__.get('run') == None or - callback.run.func_code.co_argcount < 2)) or - (callable(callback) and callback.func_code.co_argcount < 2)): + callback.run.__code__.co_argcount < 2)) or + (callable(callback) and callback.__code__.co_argcount < 2)): raise Exception("callback must be a callable with signature " + "callback(request, response, ...) or an " + "object with a callable run function with " + --- ./src/main/protobuf/server.py (original) +++ ./src/main/protobuf/server.py (refactored) @@ -37,7 +37,7 @@ ''' # Standard library imports -import SocketServer +import socketserver import threading import logging import socket @@ -76,7 +76,7 @@ -class SocketHandler(SocketServer.StreamRequestHandler): +class SocketHandler(socketserver.StreamRequestHandler): '''Handler for service requests.''' def handle(self): @@ -102,31 +102,31 @@ # Parse and validate the client's request try: request = self.parseServiceRequest(input) - except error.BadRequestDataError, e: + except error.BadRequestDataError as e: return self.handleError(e) # Retrieve the requested service try: service = self.retrieveService(request.service_name) - except error.ServiceNotFoundError, e: + except error.ServiceNotFoundError as e: return self.handleError(e) # Retrieve the requested method try: method = self.retrieveMethod(service, request.method_name) - except error.MethodNotFoundError, e: + except error.MethodNotFoundError as e: return self.handleError(e) # Retrieve the protocol message try: proto_request = self.retrieveProtoRequest(service,method,request) - except error.BadRequestProtoError, e: + except error.BadRequestProtoError as e: return self.handleError(e) # Execute the specified method of the service with the requested params try: response = self.callMethod(service, method, proto_request) - except error.RpcError, e: + except error.RpcError as e: return self.handleError(e) return response @@ -141,7 +141,7 @@ # Catch anything which isn't a valid PB bytestream try: request.MergeFromString(bytestream_from_client) - except Exception, e: + except Exception as e: raise error.BadRequestDataError("Invalid request from \ client (decodeError): " + str(e)) @@ -199,7 +199,7 @@ callback = Callback() try: service.CallMethod(method,controller,proto_request,callback) - except Exception, e: + except Exception as e: raise error.RpcError(e.message) # Return an RPC response, with payload defined in the callback @@ -232,8 +232,8 @@ -class ThreadedTCPServer(SocketServer.ThreadingMixIn,SocketServer.TCPServer): - SocketServer.allow_reuse_address = True +class ThreadedTCPServer(socketserver.ThreadingMixIn,socketserver.TCPServer): + socketserver.allow_reuse_address = True --- ./src/main/protobuf/rpc_pb2.py (original) +++ ./src/main/protobuf/rpc_pb2.py (refactored) @@ -98,14 +98,14 @@ descriptor.FieldDescriptor( name='service_name', full_name='protobuf.socketrpc.Request.service_name', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='method_name', full_name='protobuf.socketrpc.Request.method_name', index=1, number=2, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_vRefactoringTool: No changes to ./src/main/protobuf/logger.py RefactoringTool: No changes to ./src/main/protobuf/error.py RefactoringTool: No changes to ./src/main/protobuf/controller.py RefactoringTool: Refactored ./src/main/protobuf/channel.py RefactoringTool: Refactored ./src/main/protobuf/__init__.py alue=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -141,7 +141,7 @@ descriptor.FieldDescriptor( name='error', full_name='protobuf.socketrpc.Response.error', index=1, number=2, type=9, cpp_type=9, label=1, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -170,11 +170,9 @@ _RESPONSE.fields_by_name['error_reason'].enum_type = _ERRORREASON -class Request(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Request(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _REQUEST -class Response(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Response(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _RESPONSE --- ./src/main/protobuf/channel.py (original) +++ ./src/main/protobuf/channel.py (refactored) @@ -38,7 +38,7 @@ import google.protobuf.service as service # Module imports -import rpc_pb2 as rpc_pb +from . import rpc_pb2 as rpc_pb from protobuf import logger from protobuf.controller import SocketRpcController import protobuf.error as error @@ -164,7 +164,7 @@ # Catch anything which isn't a valid PB bytestream try: response.ParseFromString(byte_stream) - except Exception, e: + except Exception as e: raise error.BadResponseProtoError("Invalid response \ (decodeError): " + str(e)) @@ -221,7 +221,7 @@ # Validate the request object try: self.channel.validateRequest(request) - except error.BadRequestProtoError, e: + except error.BadRequestProtoError as e: self.controller.handleError(rpc_pb.BAD_REQUEST_PROTO, e.message) @@ -233,10 +233,10 @@ try: self.sock = self.channel.openSocket(self.channel.host,\ self.channel.port) - except error.UnknownHostError, e: + except error.UnknownHostError as e: self.controller.handleError(rpc_pb.UNKNOWN_HOST,\ e.message) - except error.IOError, e: + except error.IOError as e: self.controller.handleError(rpc_pb.IO_ERROR, e.message) @@ -249,7 +249,7 @@ # Send the request over the socket try: self.channel.sendRpcMessage(self.sock, rpcRequest) - except error.IOError, e: + except error.IOError as e: self.controller.handleError(rpc_pb.IO_ERROR, e.message) @@ -259,7 +259,7 @@ # Get the reply try: self.byte_stream = self.channel.recvRpcMessage(self.sock) - except error.IOError, e: + except error.IOError as e: self.controller.handleError(rpc_pb.IO_ERROR, e.message) @@ -270,7 +270,7 @@ try: self.rpcResponse = self.channel.parseResponse(self.byte_stream, rpc_pb.Response) - except error.BadResponseProtoError, e: + except error.BadResponseProtoError as e: self.controller.handleError(rpc_pb.BAD_RESPONSE_PROTO, e.message) @@ -282,7 +282,7 @@ self.serviceResponse = self.channel.parseResponse\ (self.rpcResponse.response_proto, response_class) - except error.BadResponseProtoError, e: + except error.BadResponseProtoError as e: self.controller.handleError(rpc_pb.BAD_RESPONSE_PROTO, e.message) --- ./src/main/protobuf/__init__.py (original) +++ ./src/main/protobuf/__init__.py (refactored) @@ -19,4 RefactoringTool: Refactored ./src/example/time/time_pb2.py RefactoringTool: Refactored ./src/example/time/run_server.py RefactoringTool: Refactored ./src/example/time/run_client.py RefactoringTool: Refactored ./src/example/helloworld/run_server.py RefactoringTool: Refactored ./src/example/helloworld/run_client.py RefactoringTool: Refactored ./src/example/helloworld/hello_world_pb2.py +19,4 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from service import RpcThread, RpcService +from .service import RpcThread, RpcService --- ./src/example/time/time_pb2.py (original) +++ ./src/example/time/time_pb2.py (refactored) @@ -53,7 +53,7 @@ descriptor.FieldDescriptor( name='str_time', full_name='protobuf.socketrpc.TimeResponse.str_time', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -67,12 +67,10 @@ -class TimeRequest(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class TimeRequest(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _TIMEREQUEST -class TimeResponse(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class TimeResponse(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _TIMERESPONSE @@ -93,10 +91,8 @@ ), ]) -class TimeService(service.Service): - __metaclass__ = service_reflection.GeneratedServiceType +class TimeService(service.Service, metaclass=service_reflection.GeneratedServiceType): DESCRIPTOR = _TIMESERVICE -class TimeService_Stub(TimeService): - __metaclass__ = service_reflection.GeneratedServiceStubType +class TimeService_Stub(TimeService, metaclass=service_reflection.GeneratedServiceStubType): DESCRIPTOR = _TIMESERVICE --- ./src/example/time/run_server.py (original) +++ ./src/example/time/run_server.py (refactored) @@ -39,7 +39,7 @@ from protobuf.server import SocketRpcServer -import time_pb2 as proto +from . import time_pb2 as proto import time import logging --- ./src/example/time/run_client.py (original) +++ ./src/example/time/run_client.py (refactored) @@ -36,7 +36,7 @@ import sys sys.path.append('../../main') -import time_pb2 as proto +from . import time_pb2 as proto import protobuf import logging @@ -57,5 +57,5 @@ try: response = service.getTime(request, timeout=1000) log.info(response) - except Exception, ex: + except Exception as ex: log.exception(ex) --- ./src/example/helloworld/run_server.py (original) +++ ./src/example/helloworld/run_server.py (refactored) @@ -31,9 +31,9 @@ sys.path.append('../../main') # Import required RPC modules -import hello_world_pb2 +from . import hello_world_pb2 import protobuf.server as server -import HelloWorldServiceImpl as impl +from . import HelloWorldServiceImpl as impl # Create and register the service @@ -44,5 +44,5 @@ server.registerService(hello_world_service) # Start the server -print 'Serving on port 8090' +print('Serving on port 8090') server.run() --- ./src/example/helloworld/run_client.py (original) +++ ./src/example/helloworld/run_client.py (refactored) @@ -34,7 +34,7 @@ import traceback # Import required RPC modules -import hello_world_pb2 +from . import hello_world_pb2 import protobuf # Configure logging @@ -64,7 +64,7 @@ try: log.info('Making asynchronous call') response = service.HelloWorld(request, callback=callback) -except Exception, ex: +except Exception as ex: log.exception(ex) # Make a synchronous call @@ -72,7 +72,7 @@ log.info('Making synchronous call') response = service.HelloWorld(request, timeout=10000) log.info('Synchronous response: ' + response.__str__()) -except Exception, ex: +except Exception as ex: log.exception(ex) --- ./src/example/helloworld/hello_world_pb2.py (original) +++ ./src/example/helloworld/hello_world_pb2.py (refactored) @@ -38,7 +38,7 @@ descriptor.FieldDescriptor( name='my_name', full_name='protobuf.socketrpc.HelloRequest.my_name', index=0, number=2, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, RefactoringTool: Refactored ./src/example/helloworld/HelloWorldServiceImpl.py RefactoringTool: No changes to ./setup.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/test_pb2.py is_extension=False, extension_scope=None, options=None), @@ -60,7 +60,7 @@ descriptor.FieldDescriptor( name='hello_world', full_name='protobuf.socketrpc.HelloResponse.hello_world', index=0, number=1, type=9, cpp_type=9, label=2, - default_value=unicode("", "utf-8"), + default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -74,12 +74,10 @@ -class HelloRequest(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class HelloRequest(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _HELLOREQUEST -class HelloResponse(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class HelloResponse(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _HELLORESPONSE @@ -100,10 +98,8 @@ ), ]) -class HelloWorldService(service.Service): - __metaclass__ = service_reflection.GeneratedServiceType +class HelloWorldService(service.Service, metaclass=service_reflection.GeneratedServiceType): DESCRIPTOR = _HELLOWORLDSERVICE -class HelloWorldService_Stub(HelloWorldService): - __metaclass__ = service_reflection.GeneratedServiceStubType +class HelloWorldService_Stub(HelloWorldService, metaclass=service_reflection.GeneratedServiceStubType): DESCRIPTOR = _HELLOWORLDSERVICE --- ./src/example/helloworld/HelloWorldServiceImpl.py (original) +++ ./src/example/helloworld/HelloWorldServiceImpl.py (refactored) @@ -28,15 +28,15 @@ May 2009 ''' -import hello_world_pb2 +from . import hello_world_pb2 import time class HelloWorldImpl(hello_world_pb2.HelloWorldService): def HelloWorld(self,controller,request,done): - print "In HelloWorld!" + print("In HelloWorld!") # Print the request - print request + print(request) # Extract name from the message received name = request.my_name --- ./python/src/protobuf/socketrpc/tests/test_pb2.py (original) +++ ./python/src/protobuf/socketrpc/tests/test_pb2.py (refactored) @@ -28,7 +28,7 @@ descriptor.FieldDescriptor( name='str_data', full_name='protobuf.socketrpc.Request.str_data', index=0, number=1, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -56,7 +56,7 @@ descriptor.FieldDescriptor( name='str_data', full_name='protobuf.socketrpc.Response.str_data', index=0, number=1, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -83,14 +83,12 @@ DESCRIPTOR.message_types_by_name['Request'] = _REQUEST DESCRIPTOR.message_types_by_name['Response'] = _RESPONSE -class Request(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Request(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _REQUEST # @@protoc_insertion_point(class_scope:protobuf.socketrpc.Request) -class Response(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Response(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _RESPONSE # @@protoc_insertion_point(class_scope:protobuf.socketrpc.Response) @@ -116,11 +114,9 @@ ), ]) -class TestService(service.Service): - __metaclass__ = service_reflection.GeneratedServiceType +class TestService(service.Service, metaclass=service_reflection.GeneratedServiceType): DESCRIPTOR = _TESTSERVICE -class TestService_Stub(TestService): - __metaclass__ = service_reflection.GeneRefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/service_test.py ratedServiceStubType +class TestService_Stub(TestService, metaclass=service_reflection.GeneratedServiceStubType): DESCRIPTOR = _TESTSERVICE # @@protoc_insertion_point(module_scope) --- ./python/src/protobuf/socketrpc/tests/service_test.py (original) +++ ./python/src/protobuf/socketrpc/tests/service_test.py (refactored) @@ -41,10 +41,10 @@ from protobuf.socketrpc.error import RpcError from protobuf.socketrpc.channel import SocketRpcChannel import protobuf.socketrpc.server as server -import fake +from . import fake # Import the protoc generated test module -import test_pb2 +from . import test_pb2 success_port = 63636 fail_port = 63637 @@ -161,7 +161,7 @@ try: controller = self.service.TestMethod(self.request, callback=callback) - except RpcError, e: + except RpcError as e: self.fail('Caught an unexpected exception %s' % e) callback.condition.wait(2.0) @@ -177,7 +177,7 @@ try: controller = self.fail_service.TestMethod(self.request, callback=callback) - except RpcError, e: + except RpcError as e: self.fail('Caught an unexpected exception %s' % e) callback.condition.wait(2.0) @@ -192,14 +192,14 @@ try: controller = self.service.TestMethod( self.request, callback=TestRpcService.callback) - except RpcError, e: + except RpcError as e: self.fail('Caught an unexpected exception %s' % e) TestRpcService.callback_method_condition.wait(2.0) self.assertTrue(TestRpcService.callback_method_called, 'Asynch callback was not called') - self.assertEquals( + self.assertEqual( self.request, TestRpcService.callback_method_request, 'Asynch callback request arg not equal to request') self.assertTrue(TestRpcService.callback_method_response is not None, @@ -213,14 +213,14 @@ try: controller = self.fail_service.TestMethod( self.request, callback=TestRpcService.callback) - except RpcError, e: + except RpcError as e: self.fail('Caught an unexpected exception %s' % e) TestRpcService.callback_method_condition.wait(2.0) self.assertTrue(TestRpcService.callback_method_called, 'Asynch callback was not called') - self.assertEquals( + self.assertEqual( self.request, TestRpcService.callback_method_request, 'Asynch callback request arg not equal to request') self.assertTrue(TestRpcService.callback_method_response is None, @@ -233,7 +233,7 @@ try: response = self.service.TestMethod(self.request) - except Exception, e: + except Exception as e: self.fail('Caught an unexpected exception %s' % e) self.assertTrue(response is not None, 'Callback response was None'); @@ -243,7 +243,7 @@ try: response = self.service.TestMethod(self.request, timeout=1000) - except RpcError, e: + except RpcError as e: self.fail('Caught an unexpected exception %s' % e) self.assertTrue(response is not None, 'Callback response was None'); @@ -255,7 +255,7 @@ try: self.fail_service.TestMethod(self.request) self.fail('Should have thrown exception') - except RpcError, e: + except RpcError as e: self.assertEqual(e.message, "YOU FAIL!") @@ -267,7 +267,7 @@ try: self.fail_service.TestMethod(self.request, timeout=1000) self.fail('Should have thrown exception') - except RpcError, e: + except RpcError as e: self.assertEqual(e.message, "YOU FAIL!") @@ -321,8 +321,8 @@ try: self.thread.run() - except Exception, e: - self.assert_(False, "TestRpcThread.run(RefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/server_test.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/run_tests.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/fake.py RefactoringTool: No changes to ./python/src/protobuf/socketrpc/tests/error_test.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/controller_test.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/tests/channel_test.py ) threw and exception", e) + except Exception as e: + self.assertTrue(False, "TestRpcThread.run() threw and exception", e) def suite(): --- ./python/src/protobuf/socketrpc/tests/server_test.py (original) +++ ./python/src/protobuf/socketrpc/tests/server_test.py (refactored) @@ -45,8 +45,8 @@ import protobuf.socketrpc.error as error # Test imports (relative imports) -from fake import FakeSocketFactory, TestServiceImpl -import test_pb2 +from .fake import FakeSocketFactory, TestServiceImpl +from . import test_pb2 class TestCallback(unittest.TestCase): @@ -155,7 +155,7 @@ response = handler.callMethod(service, method, self.service_request) - self.assertEquals(response, expected_rpc, 'Normal response') + self.assertEqual(response, expected_rpc, 'Normal response') def test_callMethod_RPC_FAILED(self): '''Test for RPCFAILED state.''' @@ -178,9 +178,9 @@ response = handler.callMethod(service, method, self.service_request) - self.assertEquals(response.error_reason, rpc_pb2.RPC_FAILED, + self.assertEqual(response.error_reason, rpc_pb2.RPC_FAILED, 'RPC_FAILED - error code') - self.assertEquals(response.error, failmsg, 'RPC_FAILED - messsage') + self.assertEqual(response.error, failmsg, 'RPC_FAILED - messsage') def test_callMethod_RPC_ERROR(self): '''Test for RPCERROR state.''' --- ./python/src/protobuf/socketrpc/tests/run_tests.py (original) +++ ./python/src/protobuf/socketrpc/tests/run_tests.py (refactored) @@ -31,11 +31,11 @@ import unittest # Module imports -import channel_test -import controller_test -import error_test -import server_test -import service_test +from . import channel_test +from . import controller_test +from . import error_test +from . import server_test +from . import service_test if __name__ == '__main__': suite = unittest.TestSuite() --- ./python/src/protobuf/socketrpc/tests/fake.py (original) +++ ./python/src/protobuf/socketrpc/tests/fake.py (refactored) @@ -35,7 +35,7 @@ # Module imports import protobuf.socketrpc.channel as ch import protobuf.socketrpc.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 class TestServiceImpl(test_pb2.TestService): @@ -111,7 +111,8 @@ self.unknownhost = False self.ioerror = False - def connect(self, (host, port)): + def connect(self, xxx_todo_changeme): + (host, port) = xxx_todo_changeme if self.unknownhost: raise socket.gaierror() --- ./python/src/protobuf/socketrpc/tests/controller_test.py (original) +++ ./python/src/protobuf/socketrpc/tests/controller_test.py (refactored) @@ -41,11 +41,11 @@ import protobuf.socketrpc.controller as controller # Import the fake stub classes used in testing to simulate sockets etc. -from fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl +from .fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl # Import the RPC definition class and the test service class import protobuf.socketrpc.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 class TestSocketRpcController(unittest.TestCase): --- ./python/src/protobuf/socketrpc/tests/channel_test.py (original) +++ ./python/src/protobuf/socketrpc/tests/channel_test.py (refactored) @@ -41,11 +41,11 @@ import protobuf.socketrpc.error as error # Import the fake stub classes used in testing to simulate sockets etc. -from fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl +from .fake import FakeSocketFactory, FakeSocket, FakeCallback, TestServiceImpl # Import the RPC definition class and the test service class import protobuf.socketrpc.rpc_pb2 as rpc_pb2 -import test_pb2 +from . import test_pb2 class TestSocketRpcChannel(unittest.TestCase): @@ -80,8 +80,8 @@ 'Initialising channel with user-supplied factory') def test___init__defaults(self): - self.assert_(self.channel.host, True) - self.assert_(self.channel.port, True) + self.assertTrue(self.channel.host, True) + self.assertTrue(self.channel.port, True) def test_validateRequest(self): self.rpc_request.service_name = "Dummy Service" @@ -101,7 +101,7 @@ def test_openSocket(self): '''Test normal return from openSocket.''' - self.assert_(self.channel.openSocket, "openSocket returns something") + self.assertTrue(self.channel.openSocket, "openSocket returns something") def test_openSocket_IO_ERROR(self): '''Test exceptional return from openSocket (IO_ERROR).''' @@ -116,7 +116,7 @@ def test_openSocket_UNKNOWN_HOST(self): '''Test exceptional return from openSocket (UNKNOWN_HOST).''' - self.assert_(self.channel.openSocket, "openSocket returns something") + self.assertTrue(self.channel.openSocket, "openSocket returns something") # Fake socket primed to throw an unknown host exception socket = FakeSocket() @@ -242,14 +242,14 @@ service = test_pb2.TestService_Stub(channel) def VerifyGoodRpc(response): - self.assertEquals(self.service_response.str_data, + self.assertEqual(self.service_response.str_data, response.str_data, 'Response message') - self.assertEquals(self.serialized_request, + self.assertEqual(self.serialized_request, socket.getRequest().request_proto, 'Request protocol serialisation') - self.assertEquals(service.DESCRIPTOR.full_name, + self.assertEqual(service.DESCRIPTOR.full_name, socket.getRequest().service_name, 'Service name') - self.assertEquals(service.DESCRIPTOR.methods[0].name, + self.assertEqual(service.DESCRIPTOR.methods[0].name, socket.getRequest().method_name, 'Method name') # Call RPC method @@ -289,7 +289,7 @@ self.assertTrue(callback.invoked, 'Callback invoked') self.assertTrue(callback.response is None, 'Response') self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.UNKNOWN_HOST, controller.reason, + self.assertEqual(rpc_pb2.UNKNOWN_HOST, controller.reason, 'Error reason') # Call Blocking RPC @@ -299,7 +299,7 @@ self.fail('Should have thrown error') except RpcError: self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.UNKNOWN_HOST, controller.reason, + self.assertEqual(rpc_pb2.UNKNOWN_HOST, controller.reason, 'Error reason') @@ -326,7 +326,7 @@ self.assertTrue(callback.invoked, 'Callback invoked') self.assertTrue(callback.response is None, 'Response') self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.IO_ERROR, controller.reason, 'Error reason') + self.assertEqual(rpc_pb2.IO_ERROR, controller.reason, 'Error reason') # Call Blocking RPC controller = channel.newController() @@ -335,7 +335,7 @@ self.fail('Should have thrown error') except RpcError: self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.IO_ERROR, controller.reason, + self.assertEqual(rpc_pb2.IO_ERROR, controller.reason, 'Error reason') @@ -364,7 +364,7 @@ self.assertTrue(callback.invoked, 'Callback invoked') self.assertTrue(callback.response is None, 'Response') - self.assertEquals(rpc_pb2.BAD_REQUEST_PROTO, controller.reason) + self.assertEqual(rpc_pb2.BAD_REQUEST_PROTO, controller.reason) self.assertTrue(controller.failed()) # Call Blocking RPC @@ -374,7 +374,7 @@ self.fail('Should have thrown error') except RpcError: self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.BAD_REQUEST_PROTO, controller.reason, + self.assertEqual(rpc_pb2.BAD_REQUEST_PROTO, controller.reason, 'Error reason') @@ -399,12 +399,12 @@ service.TestMethod(controller, self.service_request, callback) self.assertFalse(callback.invoked, 'Callback invoked') - self.assertEquals(self.serialized_request, + self.assertEqual(self.serialized_request, socket.getRequest().request_proto, 'Request protocol serialisation') - self.assertEquals(service.DESCRIPTOR.full_name, + self.assertEqual(service.DESCRIPTOR.full_name, socket.getRequest().service_name, 'Service name') - self.assertEquals(service.DESCRIPTOR.methods[0].name, + self.assertEqual(service.DESCRIPTOR.methods[0].name, socket.getRequest().method_name, 'Method name') # Call Blocking RPC @@ -436,12 +436,12 @@ # Verify request was sent and bad response received self.assertTrue(callback.invoked, 'Callback invoked') - self.assertEquals(self.serialized_request, + self.assertEqual(self.serialized_request, socket.getRequest().request_proto, 'Request protocol serialisation') self.assertTrue(controller.failed(), 'Controller failed') self.assertTrue(callback.response is None, 'Response') - self.assertEquals(rpc_pb2.BAD_RESPONSE_PROTO, controller.reason, + self.assertEqual(rpc_pb2.BAD_RESPONSE_PROTO, controller.reason, 'Controller reason') # Call Blocking RPC @@ -451,7 +451,7 @@ self.fail('Should have thrown error') except RpcError: self.assertTrue(controller.failed()) - self.assertEquals(rpc_pb2.BAD_RESPONSE_PROTO, controller.reason, + self.assertEqual(rpc_pb2.BAD_RESPONSE_PROTO, controller.reason, 'Error reason') @@ -505,13 +505,13 @@ def test_tryToValidateRequest(self): '''Test tryToValidateRequest - normal usage.''' - self.assertEquals(self.lc.tryToValidateRequest(self.rpc_request), + self.assertEqual(self.lc.tryToValidateRequest(self.rpc_request), None, "tryToValidateRequest - valid request") def test_tryToValidateRequest_con_error(self): '''Test tryToValidateRequest - controller in error state.''' - self.assertEquals(self.lc.tryToValidateRequest(self.rpc_request), + self.assertEqual(self.lc.tryToValidateRequest(self.rpc_request), None, "tryToValidateRequest - controller in error state") def test_tryToValidateRequest_BAD_REQUEST_PROTO(self): @@ -522,24 +522,24 @@ self.lc.tryToValidateRequest(self.rpc_request) - self.assertEquals(self.controller.reason, rpc_pb2.BAD_REQUEST_PROTO, + self.assertEqual(self.controller.reason, rpc_pb2.BAD_REQUEST_PROTO, "tryToValidateRequest - invalid request") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToValidateRequest - invalid request") def test_tryToOpenSocket(self): '''Test tryToOpenSocket - normal usage.''' self.lc.tryToOpenSocket() - self.assert_(self.lc.sock) + self.assertTrue(self.lc.sock) def test_tryToOpenSocket_con_error(self): '''Test tryToOpenSocket - controller in error state.''' self.controller._fail = True self.lc.tryToOpenSocket() - self.assertEquals(self.lc.sock, None, + self.assertEqual(self.lc.sock, None, "tryToOpenSocket - controller in error state") def test_tryToOpenSocket_UNKNOWN_HOST(self): @@ -548,13 +548,13 @@ self.socket.throwUnknownHostException() self.lc.tryToOpenSocket() - self.assertEquals(self.lc.sock, None, + self.assertEqual(self.lc.sock, None, "tryToOpenSocket - UNKNOWN_HOST error") - self.assertEquals(self.controller.reason, rpc_pb2.UNKNOWN_HOST, + self.assertEqual(self.controller.reason, rpc_pb2.UNKNOWN_HOST, "tryToOpenSocket - UNKNOWN_HOST error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToOpenSocket - UNKNOWN_HOST error") def test_tryToOpenSocket_IO_ERROR(self): @@ -563,13 +563,13 @@ self.socket.throwIOErrorException() self.lc.tryToOpenSocket() - self.assertEquals(self.lc.sock, None, + self.assertEqual(self.lc.sock, None, "tryToOpenSocket - IO_ERROR error") - self.assertEquals(self.controller.reason, rpc_pb2.IO_ERROR, + self.assertEqual(self.controller.reason, rpc_pb2.IO_ERROR, "tryToOpenSocket - IO_ERROR error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToOpenSocket - IO_ERROR error") def test_tryToSendRpcRequest(self): @@ -587,7 +587,7 @@ # Add the socket instance to the lifecycle object self.lc.sock = self.socket - self.assertEquals( + self.assertEqual( self.lc.tryToSendRpcRequest(method, self.rpc_request), None, "tryToSendRpcRequest - normal return") @@ -608,14 +608,14 @@ self.socket.throwIOErrorException() self.lc.sock = self.socket - self.assertEquals( + self.assertEqual( self.lc.tryToSendRpcRequest(method, self.rpc_request), None, "tryToSendRpcRequest - IO_ERROR") - self.assertEquals(self.controller.reason, rpc_pb2.IO_ERROR, + self.assertEqual(self.controller.reason, rpc_pb2.IO_ERROR, "tryToSendRpcRequest - IO_ERROR error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToSendRpcRequest - IO_ERROR error") def test_tryToReceiveReply(self): @@ -626,11 +626,11 @@ self.socket.withInputBytes(msg) self.lc.sock = self.socket - self.assertEquals(self.lc.tryToReceiveReply(), None, + self.assertEqual(self.lc.tryToReceiveReply(), None, "tryToReceiveReply - normal usage") # Verify the socket has been closed - self.assert_(self.socket.input_stream.closed, + self.assertTrue(self.socket.input_stream.closed, "tryToReceiveReply - normal usage") def test_tryToReceiveReply_IOError(self): @@ -642,17 +642,17 @@ self.socket.throwIOErrorException() self.lc.sock = self.socket - self.assertEquals(self.lc.tryToReceiveReply(), None, + self.assertEqual(self.lc.tryToReceiveReply(), None, "tryToReceiveReply - IO_ERROR error") - self.assertEquals(self.controller.reason, rpc_pb2.IO_ERROR, + self.assertEqual(self.controller.reason, rpc_pb2.IO_ERROR, "tryToReceiveReply - IO_ERROR error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToReceiveReply - IO_ERROR error") # Verify the socket has been closed - self.assert_(self.socket.input_stream.closed, + self.assertTrue(self.socket.input_stream.closed, "tryToReceiveReply - IO_ERROR error") def test_tryToParseReply(self): @@ -662,7 +662,7 @@ expected_response = resp_class() self.lc.byte_stream = expected_response.SerializeToString() - self.assertEquals(self.lc.tryToParseReply(), None, + self.assertEqual(self.lc.tryToParseReply(), None, "tryToParseReply - normal usage") def test_tryToParseReply_BAD_RESPONSE_PROTO(self): @@ -671,13 +671,13 @@ # SeRefactoringTool: Refactored ./python/src/protobuf/socketrpc/service.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/server.py tup an arbitrary and broken bytestream self.lc.byte_stream = 'ABCD' - self.assertEquals(self.lc.tryToParseReply(), None, + self.assertEqual(self.lc.tryToParseReply(), None, "tryToParseReply - BAD_RESPONSE_PROTO error") - self.assertEquals(self.controller.reason, rpc_pb2.BAD_RESPONSE_PROTO, + self.assertEqual(self.controller.reason, rpc_pb2.BAD_RESPONSE_PROTO, "tryToParseReply - BAD_RESPONSE_PROTO error") - self.assertEquals(self.controller.failed(), True, + self.assertEqual(self.controller.failed(), True, "tryToParseReply - BAD_RESPONSE_PROTO error") def test_tryToRetrieveServiceResponse(self): @@ -689,7 +689,7 @@ self.lc.byte_stream = expected_response.SerializeToString() self.lc.rpcResponse = expected_response - self.assertEquals(self.lc.tryToRetrieveServiceResponse(resp_class), + self.assertEqual(self.lc.tryToRetrieveServiceResponse(resp_class), None, "tryToRetrieveServiceResponse - normal usage") def test_tryToRetrieveServiceResponse_BAD_RESPONSE_PROTO(self): @@ -706,7 +706,7 @@ callback = FakeCallback() self.lc.rpcResponse = rpc_pb2.Response() - self.assertEquals(self.lc.tryToRunCallback(callback), None, + self.assertEqual(self.lc.tryToRunCallback(callback), None, "tryToRunCallback - normal usage") --- ./python/src/protobuf/socketrpc/service.py (original) +++ ./python/src/protobuf/socketrpc/service.py (refactored) @@ -173,9 +173,9 @@ else: if ((not callable(callback) and (callback.__class__.__dict__.get('run') == None or - callback.run.func_code.co_argcount < 2)) or + callback.run.__code__.co_argcount < 2)) or (callable(callback) and - callback.func_code.co_argcount < 2)): + callback.__code__.co_argcount < 2)): raise Exception("callback must be a callable with signature " + "callback(request, response, ...) or an " + "object with a callable run function with " + --- ./python/src/protobuf/socketrpc/server.py (original) +++ ./python/src/protobuf/socketrpc/server.py (refactored) @@ -39,7 +39,7 @@ ''' # Standard library imports -import SocketServer +import socketserver import logging # Third-party imports @@ -72,12 +72,12 @@ self.invoked = True -class SocketHandler(SocketServer.StreamRequestHandler): +class SocketHandler(socketserver.StreamRequestHandler): '''Handler for service requests.''' def __init__(self, request, client_address, server, socket_rpc_server): self.socket_rpc_server = socket_rpc_server - SocketServer.StreamRequestHandler.__init__( + socketserver.StreamRequestHandler.__init__( self, request, client_address, server) def handle(self): @@ -101,31 +101,31 @@ # Parse and validate the client's request try: request = self.parseServiceRequest(input) - except error.BadRequestDataError, e: + except error.BadRequestDataError as e: return self.handleError(e) # Retrieve the requested service try: service = self.retrieveService(request.service_name) - except error.ServiceNotFoundError, e: + except error.ServiceNotFoundError as e: return self.handleError(e) # Retrieve the requested method try: method = self.retrieveMethod(service, request.method_name) - except error.MethodNotFoundError, e: + except error.MethodNotFoundError as e: return self.handleError(e) # Retrieve the protocol message try: proto_request = self.retrieveProtoRequest(service, method, request) - except error.BadRequestProtoError, e: + except error.BadRequestProtoError as e: RefactoringTool: Refactored ./python/src/protobuf/socketrpc/rpc_pb2.py return self.handleError(e) # Execute the specified method of the service with the requested params try: response = self.callMethod(service, method, proto_request) - except error.RpcError, e: + except error.RpcError as e: return self.handleError(e) return response @@ -139,7 +139,7 @@ # Catch anything which isn't a valid PB bytestream try: request.MergeFromString(bytestream_from_client) - except Exception, e: + except Exception as e: raise error.BadRequestDataError("Invalid request from \ client (decodeError): " + str(e)) @@ -175,8 +175,8 @@ proto_request = service.GetRequestClass(method)() try: proto_request.ParseFromString(request.request_proto) - except Exception, e: - raise error.BadRequestProtoError(unicode(e)) + except Exception as e: + raise error.BadRequestProtoError(str(e)) # Check the request parsed correctly if not proto_request.IsInitialized(): @@ -195,8 +195,8 @@ callback = Callback() try: service.CallMethod(method, controller, proto_request, callback) - except Exception, e: - raise error.RpcError(unicode(e)) + except Exception as e: + raise error.RpcError(str(e)) # Return an RPC response, with payload defined in the callback response = rpc_pb.Response() @@ -225,12 +225,12 @@ return response -class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): - SocketServer.allow_reuse_address = True +class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): + socketserver.allow_reuse_address = True def __init__(self, server_address, RequestHandlerClass, socket_rpc_server): """Constructor. May be extended, do not override.""" - SocketServer.TCPServer.__init__( + socketserver.TCPServer.__init__( self, server_address, RequestHandlerClass) self.socket_rpc_server = socket_rpc_server --- ./python/src/protobuf/socketrpc/rpc_pb2.py (original) +++ ./python/src/protobuf/socketrpc/rpc_pb2.py (refactored) @@ -110,14 +110,14 @@ descriptor.FieldDescriptor( name='service_name', full_name='protobuf.socketrpc.Request.service_name', index=0, number=1, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), descriptor.FieldDescriptor( name='method_name', full_name='protobuf.socketrpc.Request.method_name', index=1, number=2, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -159,7 +159,7 @@ descriptor.FieldDescriptor( name='error', full_name='protobuf.socketrpc.Response.error', index=1, number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -194,14 +194,12 @@ DESCRIPTOR.message_types_by_name['Request'] = _REQUEST DESCRIPTOR.message_types_by_name['Response'] = _RESPONSE -class Request(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class Request(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _REQUEST # @@protoc_insertion_point(class_scope:protobuf.socketrpc.Request) -class Response(message.Message): - __metaRefactoringTool: No changes to ./python/src/protobuf/socketrpc/logger.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/time/time_pb2.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/time/run_server.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/time/run_client.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/helloworld/run_server.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/helloworld/run_client.py class__ = reflection.GeneratedProtocolMessageType +class Response(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _RESPONSE # @@protoc_insertion_point(class_scope:protobuf.socketrpc.Response) --- ./python/src/protobuf/socketrpc/examples/time/time_pb2.py (original) +++ ./python/src/protobuf/socketrpc/examples/time/time_pb2.py (refactored) @@ -69,7 +69,7 @@ descriptor.FieldDescriptor( name='str_time', full_name='protobuf.socketrpc.TimeResponse.str_time', index=0, number=1, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -89,14 +89,12 @@ DESCRIPTOR.message_types_by_name['TimeRequest'] = _TIMEREQUEST DESCRIPTOR.message_types_by_name['TimeResponse'] = _TIMERESPONSE -class TimeRequest(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class TimeRequest(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _TIMEREQUEST # @@protoc_insertion_point(class_scope:protobuf.socketrpc.TimeRequest) -class TimeResponse(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class TimeResponse(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _TIMERESPONSE # @@protoc_insertion_point(class_scope:protobuf.socketrpc.TimeResponse) @@ -122,11 +120,9 @@ ), ]) -class TimeService(service.Service): - __metaclass__ = service_reflection.GeneratedServiceType +class TimeService(service.Service, metaclass=service_reflection.GeneratedServiceType): DESCRIPTOR = _TIMESERVICE -class TimeService_Stub(TimeService): - __metaclass__ = service_reflection.GeneratedServiceStubType +class TimeService_Stub(TimeService, metaclass=service_reflection.GeneratedServiceStubType): DESCRIPTOR = _TIMESERVICE # @@protoc_insertion_point(module_scope) --- ./python/src/protobuf/socketrpc/examples/time/run_server.py (original) +++ ./python/src/protobuf/socketrpc/examples/time/run_server.py (refactored) @@ -42,7 +42,7 @@ from protobuf.socketrpc.server import SocketRpcServer -import time_pb2 as proto +from . import time_pb2 as proto import time import logging --- ./python/src/protobuf/socketrpc/examples/time/run_client.py (original) +++ ./python/src/protobuf/socketrpc/examples/time/run_client.py (refactored) @@ -40,7 +40,7 @@ import sys sys.path.append('../../main') -import time_pb2 as proto +from . import time_pb2 as proto from protobuf.socketrpc import RpcService import logging @@ -60,5 +60,5 @@ try: response = service.getTime(request, timeout=1000) log.info(response) - except Exception, ex: + except Exception as ex: log.exception(ex) --- ./python/src/protobuf/socketrpc/examples/helloworld/run_server.py (original) +++ ./python/src/protobuf/socketrpc/examples/helloworld/run_server.py (refactored) @@ -34,7 +34,7 @@ # Import required RPC modules import protobuf.socketrpc.server as server -import HelloWorldServiceImpl as impl +from . import HelloWorldServiceImpl as impl # Create and register the service @@ -45,5 +45,5 @@ server.registerService(hello_world_service) # Start the server -print 'Serving on port 8090' +print('Serving on port 8090') server.run() --- ./python/src/protobuf/socketrpc/examples/helloworld/run_client.py (original) +++ ./python/src/protobuf/socketrpc/examples/helloworld/run_client.py (refactored) @@ -35,7 +35,7 @@ sys.path.append('../../main') # Import required RPC modules -import hello_world_pb2 +from . import hello_world_pb2 from protobuf.socketrpc import RpcService # Configure logging @@ -66,7 +66,7 @@ try: log.info('Making asynchronous call') response = service.HelloWorld(request, callback=callback) -except Exception, ex: +except Exception as ex: log.exception(ex) # Make a synchronous call @@ -74,5 +74,5 @@ RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/helloworld/hello_world_pb2.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/examples/helloworld/HelloWorldServiceImpl.py RefactoringTool: No changes to ./python/src/protobuf/socketrpc/error.py RefactoringTool: No changes to ./python/src/protobuf/socketrpc/controller.py RefactoringTool: Refactored ./python/src/protobuf/socketrpc/channel.py log.info('Making synchronous call') response = service.HelloWorld(request, timeout=10000) log.info('Synchronous response: ' + response.__str__()) -except Exception, ex: +except Exception as ex: log.exception(ex) --- ./python/src/protobuf/socketrpc/examples/helloworld/hello_world_pb2.py (original) +++ ./python/src/protobuf/socketrpc/examples/helloworld/hello_world_pb2.py (refactored) @@ -48,7 +48,7 @@ descriptor.FieldDescriptor( name='my_name', full_name='protobuf.socketrpc.HelloRequest.my_name', index=0, number=2, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -76,7 +76,7 @@ descriptor.FieldDescriptor( name='hello_world', full_name='protobuf.socketrpc.HelloResponse.hello_world', index=0, number=1, type=9, cpp_type=9, label=2, - has_default_value=False, default_value=unicode("", "utf-8"), + has_default_value=False, default_value=str("", "utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), @@ -96,14 +96,12 @@ DESCRIPTOR.message_types_by_name['HelloRequest'] = _HELLOREQUEST DESCRIPTOR.message_types_by_name['HelloResponse'] = _HELLORESPONSE -class HelloRequest(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class HelloRequest(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _HELLOREQUEST # @@protoc_insertion_point(class_scope:protobuf.socketrpc.HelloRequest) -class HelloResponse(message.Message): - __metaclass__ = reflection.GeneratedProtocolMessageType +class HelloResponse(message.Message, metaclass=reflection.GeneratedProtocolMessageType): DESCRIPTOR = _HELLORESPONSE # @@protoc_insertion_point(class_scope:protobuf.socketrpc.HelloResponse) @@ -129,11 +127,9 @@ ), ]) -class HelloWorldService(service.Service): - __metaclass__ = service_reflection.GeneratedServiceType +class HelloWorldService(service.Service, metaclass=service_reflection.GeneratedServiceType): DESCRIPTOR = _HELLOWORLDSERVICE -class HelloWorldService_Stub(HelloWorldService): - __metaclass__ = service_reflection.GeneratedServiceStubType +class HelloWorldService_Stub(HelloWorldService, metaclass=service_reflection.GeneratedServiceStubType): DESCRIPTOR = _HELLOWORLDSERVICE # @@protoc_insertion_point(module_scope) --- ./python/src/protobuf/socketrpc/examples/helloworld/HelloWorldServiceImpl.py (original) +++ ./python/src/protobuf/socketrpc/examples/helloworld/HelloWorldServiceImpl.py (refactored) @@ -28,16 +28,16 @@ May 2009 ''' -import hello_world_pb2 +from . import hello_world_pb2 import time class HelloWorldImpl(hello_world_pb2.HelloWorldService): def HelloWorld(self, controller, request, done): - print "In HelloWorld!" + print("In HelloWorld!") # Print the request - print request + print(request) # Extract name from the message received name = request.my_name --- ./python/src/protobuf/socketrpc/channel.py (original) +++ ./python/src/protobuf/socketrpc/channel.py (refactored) @@ -41,7 +41,7 @@ from protobuf.socketrpc.error import RpcError # Module imports -import rpc_pb2 as rpc_pb +from . import rpc_pb2 as rpc_pb from protobuf.socketrpc import logger from protobuf.socketrpc.controller import SocketRpcController from protobuf.socketrpc import error @@ -157,7 +157,7 @@ # Catch anything which isn't a valid PB bytestream try: response.ParseFromString(byte_stream) - except Exception, e: + except Exception as e: raise error.BadResponseProtoError("Invalid response \ (decodeError): " + str(e)) @@ -210,7 +210,7 @@ # Validate the request object try: RefactoringTool: Refactored ./python/src/protobuf/socketrpc/__init__.py RefactoringTool: No changes to ./python/setup.py RefactoringTool: Files that were modified: RefactoringTool: ./src/test/protobuf/test_pb2.py RefactoringTool: ./src/test/protobuf/service_test.py RefactoringTool: ./src/test/protobuf/server_test.py RefactoringTool: ./src/test/protobuf/run_tests.py RefactoringTool: ./src/test/protobuf/fake.py RefactoringTool: ./src/test/protobuf/error_test.py RefactoringTool: ./src/test/protobuf/controller_test.py RefactoringTool: ./src/test/protobuf/channel_test.py RefactoringTool: ./src/main/protobuf/service.py RefactoringTool: ./src/main/protobuf/server.py RefactoringTool: ./src/main/protobuf/rpc_pb2.py RefactoringTool: ./src/main/protobuf/logger.py RefactoringTool: ./src/main/protobuf/error.py RefactoringTool: ./src/main/protobuf/controller.py RefactoringTool: ./src/main/protobuf/channel.py RefactoringTool: ./src/main/protobuf/__init__.py RefactoringTool: ./src/example/time/time_pb2.py RefactoringTool: ./src/example/time/run_server.py RefactoringTool: ./src/example/time/run_client.py RefactoringTool: ./src/example/helloworld/run_server.py RefactoringTool: ./src/example/helloworld/run_client.py RefactoringTool: ./src/example/helloworld/hello_world_pb2.py RefactoringTool: ./src/example/helloworld/HelloWorldServiceImpl.py RefactoringTool: ./setup.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/test_pb2.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/service_test.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/server_test.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/run_tests.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/fake.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/error_test.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/controller_test.py RefactoringTool: ./python/src/protobuf/socketrpc/tests/channel_test.py RefactoringTool: ./python/src/protobuf/socketrpc/service.py RefactoringTool: ./python/src/protobuf/socketrpc/server.py RefactoringTool: ./python/src/protobuf/socketrpc/rpc_pb2.py RefactoringTool: ./python/src/protobuf/socketrpc/logger.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/time/time_pb2.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/time/run_server.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/time/run_client.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/helloworld/run_server.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/helloworld/run_client.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/helloworld/hello_world_pb2.py RefactoringTool: ./python/src/protobuf/socketrpc/examples/helloworld/HelloWorldServiceImpl.py RefactoringTool: ./python/src/protobuf/socketrpc/error.py RefactoringTool: ./python/src/protobuf/socketrpc/controller.py RefactoringTool: ./python/src/protobuf/socketrpc/channel.py RefactoringTool: ./python/src/protobuf/socketrpc/__init__.py RefactoringTool: ./python/setup.py self.channel.validateRequest(request) - except error.BadRequestProtoError, e: + except error.BadRequestProtoError as e: self.controller.handleError(rpc_pb.BAD_REQUEST_PROTO, e.message) @@ -222,10 +222,10 @@ try: self.sock = self.channel.openSocket(self.channel.host, self.channel.port) - except error.UnknownHostError, e: + except error.UnknownHostError as e: self.controller.handleError(rpc_pb.UNKNOWN_HOST, e.message) - except error.IOError, e: + except error.IOError as e: self.controller.handleError(rpc_pb.IO_ERROR, e.message) def tryToSendRpcRequest(self, method, request): @@ -238,7 +238,7 @@ # Send the request over the socket try: self.channel.sendRpcMessage(self.sock, rpcRequest) - except error.IOError, e: + except error.IOError as e: self.controller.handleError(rpc_pb.IO_ERROR, e.message) def tryToReceiveReply(self): @@ -248,7 +248,7 @@ # Get the reply try: self.byte_stream = self.channel.recvRpcMessage(self.sock) - except error.IOError, e: + except error.IOError as e: self.controller.handleError(rpc_pb.IO_ERROR, e.message) def tryToParseReply(self): @@ -259,7 +259,7 @@ try: self.rpcResponse = self.channel.parseResponse(self.byte_stream, rpc_pb.Response) - except error.BadResponseProtoError, e: + except error.BadResponseProtoError as e: self.controller.handleError(rpc_pb.BAD_RESPONSE_PROTO, e.message) def tryToRetrieveServiceResponse(self, response_class): @@ -276,7 +276,7 @@ try: self.serviceResponse = self.channel.parseResponse( self.rpcResponse.response_proto, response_class) - except error.BadResponseProtoError, e: + except error.BadResponseProtoError as e: self.controller.handleError(rpc_pb.BAD_RESPONSE_PROTO, e.message) --- ./python/src/protobuf/socketrpc/__init__.py (original) +++ ./python/src/protobuf/socketrpc/__init__.py (refactored) @@ -19,4 +19,4 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -from service import RpcThread, RpcService +from .service import RpcThread, RpcService ++ find ./ -name '*.py' + sed -i 's|str("", "utf-8")|"".encode("utf-8")|' ./src/test/protobuf/test_pb2.py ./src/test/protobuf/service_test.py ./src/test/protobuf/server_test.py ./src/test/protobuf/run_tests.py ./src/test/protobuf/fake.py ./src/test/protobuf/error_test.py ./src/test/protobuf/controller_test.py ./src/test/protobuf/channel_test.py ./src/test/protobuf/__init__.py ./src/main/protobuf/service.py ./src/main/protobuf/server.py ./src/main/protobuf/rpc_pb2.py ./src/main/protobuf/logger.py ./src/main/protobuf/error.py ./src/main/protobuf/controller.py ./src/main/protobuf/channel.py ./src/main/protobuf/__init__.py ./src/example/time/time_pb2.py ./src/example/time/run_server.py ./src/example/time/run_client.py ./src/example/time/__init__.py ./src/example/helloworld/run_server.py ./src/example/helloworld/run_client.py ./src/example/helloworld/hello_world_pb2.py ./src/example/helloworld/__init__.py ./src/example/helloworld/HelloWorldServiceImpl.py ./setup.py ./python/src/protobuf/socketrpc/tests/test_pb2.py ./python/src/protobuf/socketrpc/tests/service_test.py ./python/src/protobuf/socketrpc/tests/server_test.py ./python/src/protobuf/socketrpc/tests/run_tests.py ./python/src/protobuf/socketrpc/tests/fake.py ./python/src/protobuf/socketrpc/tests/error_test.py ./python/src/protobuf/socketrpc/tests/controller_test.py ./python/src/protobuf/socketrpc/tests/channel_test.py ./python/src/protobuf/socketrpc/tests/__init__.py ./python/src/protobuf/socketrpc/service.py ./python/src/protobuf/socketrpc/server.py ./python/src/protobuf/socketrpc/rpc_pb2.py ./python/src/protobuf/socketrpc/logger.py ./python/src/protobuf/socketrpc/examples/time/time_pb2.py ./python/src/protobuf/socketrpc/examples/time/run_server.py ./python/src/protobuf/socketrpc/examples/time/run_client.py ./python/src/protobuf/socketrpc/examples/time/__init__.py ./python/src/protobuf/socketrpc/examples/helloworld/run_server.py ./python/src/protobuf/socketrpc/examples/helloworld/run_client.py ./python/src/protobuf/socketrpc/examples/helloworld/hello_world_pb2.py ./python/src/protobuf/socketrpc/examples/helloworld/__init__.py ./python/src/protobuf/socketrpc/examples/helloworld/HelloWorldServiceImpl.py ./python/src/protobuf/socketrpc/examples/__init__.py ./python/src/protobuf/socketrpc/error.py ./python/src/protobuf/socketrpc/controller.py ./python/src/protobuf/socketrpc/channel.py ./python/src/protobuf/socketrpc/__init__.py ./python/src/protobuf/__init__.py ./python/setup.py + exit 0 Executing(%build): /bin/sh -e /usr/src/tmp/rpm-tmp.45407 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + cd python3-module-protobuf-socket-rpc-1.3.1 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py build running build running build_py creating build creating build/lib creating build/lib/protobuf copying src/main/protobuf/__init__.py -> build/lib/protobuf copying src/main/protobuf/channel.py -> build/lib/protobuf copying src/main/protobuf/controller.py -> build/lib/protobuf copying src/main/protobuf/error.py -> build/lib/protobuf copying src/main/protobuf/logger.py -> build/lib/protobuf copying src/main/protobuf/rpc_pb2.py -> build/lib/protobuf copying src/main/protobuf/server.py -> build/lib/protobuf copying src/main/protobuf/service.py -> build/lib/protobuf + exit 0 Executing(%install): /bin/sh -e /usr/src/tmp/rpm-tmp.45407 + umask 022 + /bin/mkdir -p /usr/src/RPM/BUILD + cd /usr/src/RPM/BUILD + /bin/chmod -Rf u+rwX -- /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot + : + /bin/rm -rf -- /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot + cd python3-module-protobuf-socket-rpc-1.3.1 + CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CFLAGS + CXXFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export CXXFLAGS + FFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 -march=i586 -mtune=generic' + export FFLAGS + /usr/bin/python3 setup.py install --skip-build --root=/usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot --force running install running install_lib creating /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot creating /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr creating /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib creating /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3 creating /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages creating /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/service.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/server.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/rpc_pb2.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/logger.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/error.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/controller.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/channel.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf copying build/lib/protobuf/__init__.py -> /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/service.py to service.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/server.py to server.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/rpc_pb2.py to rpc_pb2.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/logger.py to logger.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/error.py to error.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/controller.py to controller.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/channel.py to channel.cpython-38.pyc byte-compiling /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__init__.py to __init__.cpython-38.pyc running install_egg_info running egg_info creating src/main/protobuf_socket_rpc.egg-info writing src/main/protobuf_socket_rpc.egg-info/PKG-INFO writing dependency_links to src/main/protobuf_socket_rpc.egg-info/dependency_links.txt writing top-level names to src/main/protobuf_socket_rpc.egg-info/top_level.txt writing manifest file 'src/main/protobuf_socket_rpc.egg-info/SOURCES.txt' reading manifest file 'src/main/protobuf_socket_rpc.egg-info/SOURCES.txt' writing manifest file 'src/main/protobuf_socket_rpc.egg-info/SOURCES.txt' Copying src/main/protobuf_socket_rpc.egg-info to /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.8.egg-info running install_scripts + /usr/lib/rpm/brp-alt Cleaning files in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot (auto) Verifying and fixing files in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot (binconfig,pkgconfig,libtool,desktop) Checking contents of files in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/ (default) Compressing files in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot (auto) Adjusting library links in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot ./usr/lib: Verifying ELF objects in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot (arch=normal,fhs=normal,lfs=relaxed,lint=relaxed,rpath=normal,stack=normal,textrel=normal,unresolved=normal) Bytecompiling python modules in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot using /usr/bin/python2.7 Bytecompiling python modules with optimization in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot using /usr/bin/python2.7 -O Bytecompiling python3 modules in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot using /usr/bin/python3 unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-38.pyc unlink /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-38.pyc compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__init__.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/channel.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/controller.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/error.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/logger.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/rpc_pb2.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/server.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/service.py Bytecompiling python3 modules with optimization in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot using /usr/bin/python3 -O compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__init__.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/channel.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/controller.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/error.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/logger.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/rpc_pb2.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/server.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/service.py Bytecompiling python3 modules with optimization-2 in /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot using /usr/bin/python3 -OO compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__init__.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/channel.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/controller.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/error.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/logger.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/rpc_pb2.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/server.py compile /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/service.py Hardlinking identical .pyc and .opt-?.pyc files './usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.opt-1.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.opt-1.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.pyc' './usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.opt-2.pyc' => './usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.opt-1.pyc' Hardlinking identical .pyc and .pyo files Processing files: python3-module-protobuf-socket-rpc-1.3.1-alt3 Finding Provides (using /usr/lib/rpm/find-provides) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.ym0zbG find-provides: running scripts (alternatives,debuginfo,lib,pam,perl,pkgconfig,python,python3,shell) Finding Requires (using /usr/lib/rpm/find-requires) Executing: /bin/sh -e /usr/src/tmp/rpm-tmp.Y6XBvF find-requires: running scripts (cpp,debuginfo,files,lib,pam,perl,pkgconfig,pkgconfiglib,python,python3,rpmlib,shebang,shell,static,symlinks,systemd-services) /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__init__.py: line=22 possible relative import from ., UNIMPLEMENTED /usr/lib/rpm/python3.req.py: /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/channel.py: line=41 possible relative import from ., UNIMPLEMENTED python3.req: /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/service.py: skipping time shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/__init__.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/channel.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/controller.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/error.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/logger.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/rpc_pb2.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/server.py is not executable shebang.req.files: executable script /usr/src/tmp/python3-module-protobuf-socket-rpc-buildroot/usr/lib/python3/site-packages/protobuf/service.py is not executable Provides: python3(protobuf), python3(protobuf.channel), python3(protobuf.controller), python3(protobuf.error), python3(protobuf.logger), python3(protobuf.rpc_pb2), python3(protobuf.server), python3(protobuf.service) Requires: python3-module-protobuf, /usr/lib/python3/site-packages, python3(google.protobuf) < 0, python3(google.protobuf.service) < 0, python3(logging) < 0, python3(socket) < 0, python3(socketserver) < 0, python3(threading) < 0 Wrote: /usr/src/RPM/RPMS/noarch/python3-module-protobuf-socket-rpc-1.3.1-alt3.noarch.rpm 9.87user 0.49system 0:11.30elapsed 91%CPU (0avgtext+0avgdata 26352maxresident)k 0inputs+0outputs (0major+129046minor)pagefaults 0swaps 17.97user 4.55system 0:23.11elapsed 97%CPU (0avgtext+0avgdata 110680maxresident)k 0inputs+0outputs (0major+571191minor)pagefaults 0swaps --- python3-module-protobuf-socket-rpc-1.3.1-alt3.noarch.rpm.repo 2020-02-21 12:16:24.000000000 +0000 +++ python3-module-protobuf-socket-rpc-1.3.1-alt3.noarch.rpm.hasher 2020-07-25 08:07:39.969950684 +0000 @@ -3,26 +3,26 @@ /usr/lib/python3/site-packages/protobuf/__pycache__ 40755 -/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-37.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-37.opt-1.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-37.opt-2.pyc 100644 -/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-37.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/__init__.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/channel.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/controller.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/error.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/logger.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/rpc_pb2.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/server.cpython-38.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-38.opt-1.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-38.opt-2.pyc 100644 +/usr/lib/python3/site-packages/protobuf/__pycache__/service.cpython-38.pyc 100644 /usr/lib/python3/site-packages/protobuf/channel.py 100644 @@ -34,7 +34,7 @@ /usr/lib/python3/site-packages/protobuf/service.py 100644 -/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.7.egg-info 40755 -/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.7.egg-info/PKG-INFO 100644 -/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.7.egg-info/SOURCES.txt 100644 -/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.7.egg-info/dependency_links.txt 100644 -/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.7.egg-info/top_level.txt 100644 +/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.8.egg-info 40755 +/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.8.egg-info/PKG-INFO 100644 +/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.8.egg-info/SOURCES.txt 100644 +/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.8.egg-info/dependency_links.txt 100644 +/usr/lib/python3/site-packages/protobuf_socket_rpc-1.3.1-py3.8.egg-info/top_level.txt 100644 Requires: python3-module-protobuf