diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 3af6590eafd..cddeb558fff 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -20,4 +20,4 @@ jobs: run: pip install ruff - name: Run Ruff - run: ruff check . --exclude "python" --ignore E402 + run: ruff check . --ignore E402 diff --git a/python/allTests.py b/python/allTests.py index 94a9466c3db..58b0a12520c 100755 --- a/python/allTests.py +++ b/python/allTests.py @@ -5,6 +5,7 @@ import os import sys + sys.path.append(os.path.join(os.path.dirname(__file__), "..", "scripts")) from Util import runTestsWithPath diff --git a/python/config/s2py.py b/python/config/s2py.py index f96bd7263a5..24604e08ca0 100755 --- a/python/config/s2py.py +++ b/python/config/s2py.py @@ -12,8 +12,15 @@ if sys.platform == "win32": platformName = "Win32" if "32bit" in platform.architecture() else "x64" configurationName = os.getenv("CPP_CONFIGURATION", "Release") - sys.path.insert(1, os.path.join(basepath, "..", "python", platformName, configurationName)) - os.putenv("PATH", os.path.join(basepath, "..", "..", "cpp", "bin", platformName, configurationName)) + sys.path.insert( + 1, os.path.join(basepath, "..", "python", platformName, configurationName) + ) + os.putenv( + "PATH", + os.path.join( + basepath, "..", "..", "cpp", "bin", platformName, configurationName + ), + ) else: sys.path.insert(1, os.path.join(basepath, "..", "python")) @@ -25,5 +32,5 @@ def main(): sys.exit(int(val)) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/python/python/Glacier2/__init__.py b/python/python/Glacier2/__init__.py index 5ce8afea632..a6421a773b2 100644 --- a/python/python/Glacier2/__init__.py +++ b/python/python/Glacier2/__init__.py @@ -2,11 +2,12 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # +# ruff: noqa: F401, F821 + """ Glacier2 module """ -import threading import traceback import copy @@ -14,6 +15,7 @@ # Import the Python extension. # import Ice + Ice.updateModule("Glacier2") import Glacier2.Router_ice @@ -34,13 +36,11 @@ def __init__(self): class Application(Ice.Application): - def __init__(self, signalPolicy=0): # HandleSignals=0 - '''The constructor accepts an optional argument indicating -whether to handle signals. The value should be either -Application.HandleSignals (the default) or -Application.NoSignalHandling. -''' + """The constructor accepts an optional argument indicating + whether to handle signals. The value should be either + Application.HandleSignals (the default) or + Application.NoSignalHandling.""" if type(self) == Application: raise RuntimeError("Glacier2.Application is an abstract class") @@ -53,50 +53,63 @@ def __init__(self, signalPolicy=0): # HandleSignals=0 Application._category = None def run(self, args): - raise RuntimeError('run should not be called on Glacier2.Application - call runWithSession instead') + raise RuntimeError( + "run should not be called on Glacier2.Application - call runWithSession instead" + ) def createSession(self, args): - raise RuntimeError('createSession() not implemented') + raise RuntimeError("createSession() not implemented") def runWithSession(self, args): - raise RuntimeError('runWithSession() not implemented') + raise RuntimeError("runWithSession() not implemented") def sessionDestroyed(self): pass def restart(self): raise RestartSessionException() + restart = classmethod(restart) def router(self): return Application._router + router = classmethod(router) def session(self): return Application._session + session = classmethod(session) def categoryForClient(self): - if Application._router == None: + if Application._router is None: raise SessionNotExistException() return Application._category + categoryForClient = classmethod(categoryForClient) def createCallbackIdentity(self, name): return Ice.Identity(name, self.categoryForClient()) + createCallbackIdentity = classmethod(createCallbackIdentity) def addWithUUID(self, servant): - return self.objectAdapter().add(servant, self.createCallbackIdentity(Ice.generateUUID())) + return self.objectAdapter().add( + servant, self.createCallbackIdentity(Ice.generateUUID()) + ) + addWithUUID = classmethod(addWithUUID) def objectAdapter(self): - if Application._router == None: + if Application._router is None: raise SessionNotExistException() - if Application._adapter == None: - Application._adapter = self.communicator().createObjectAdapterWithRouter("", Application._router) + if Application._adapter is None: + Application._adapter = self.communicator().createObjectAdapterWithRouter( + "", Application._router + ) Application._adapter.activate() return Application._adapter + objectAdapter = classmethod(objectAdapter) def doMainInternal(self, args, initData): @@ -112,8 +125,10 @@ def doMainInternal(self, args, initData): try: Ice.Application._communicator = Ice.initialize(args, initData) - Application._router = RouterPrx.uncheckedCast(Ice.Application.communicator().getDefaultRouter()) - if Application._router == None: + Application._router = RouterPrx.uncheckedCast( + Ice.Application.communicator().getDefaultRouter() + ) + if Application._router is None: Ice.getProcessLogger().error("no glacier2 router configured") status = 1 else: @@ -135,15 +150,19 @@ def doMainInternal(self, args, initData): acmTimeout = 0 try: acmTimeout = Application._router.getACMTimeout() - except (Ice.OperationNotExistException): + except Ice.OperationNotExistException: pass if acmTimeout <= 0: acmTimeout = Application._router.getSessionTimeout() if acmTimeout > 0: connection = Application._router.ice_getCachedConnection() - assert (connection) - connection.setACM(acmTimeout, Ice.Unset, Ice.ACMHeartbeat.HeartbeatAlways) - connection.setCloseCallback(lambda conn: self.sessionDestroyed()) + assert connection + connection.setACM( + acmTimeout, Ice.Unset, Ice.ACMHeartbeat.HeartbeatAlways + ) + connection.setCloseCallback( + lambda conn: self.sessionDestroyed() + ) Application._category = Application._router.getCategoryForClient() status = self.runWithSession(args) @@ -151,13 +170,18 @@ def doMainInternal(self, args, initData): # break down in communications, but not those exceptions that # indicate a programming logic error (ie: marshal, protocol # failure, etc). - except (RestartSessionException): + except RestartSessionException: restart = True - except (Ice.ConnectionRefusedException, Ice.ConnectionLostException, Ice.UnknownLocalException, - Ice.RequestFailedException, Ice.TimeoutException): + except ( + Ice.ConnectionRefusedException, + Ice.ConnectionLostException, + Ice.UnknownLocalException, + Ice.RequestFailedException, + Ice.TimeoutException, + ): Ice.getProcessLogger().error(traceback.format_exc()) restart = True - except: + except Exception: Ice.getProcessLogger().error(traceback.format_exc()) status = 1 @@ -188,15 +212,17 @@ def doMainInternal(self, args, initData): Application._router.destroySession() except (Ice.ConnectionLostException, SessionNotExistException): pass - except: - Ice.getProcessLogger().error("unexpected exception when destroying the session " + - traceback.format_exc()) + except Exception: + Ice.getProcessLogger().error( + "unexpected exception when destroying the session " + + traceback.format_exc() + ) Application._router = None if Ice.Application._communicator: try: Ice.Application._communicator.destroy() - except: + except Exception: getProcessLogger().error(traceback.format_exc()) status = 1 diff --git a/python/python/Ice/CommunicatorF_local.py b/python/python/Ice/CommunicatorF_local.py index 876ebc6e5f0..523082784ae 100644 --- a/python/python/Ice/CommunicatorF_local.py +++ b/python/python/Ice/CommunicatorF_local.py @@ -18,10 +18,10 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'Communicator' not in _M_Ice.__dict__: - _M_Ice._t_Communicator = IcePy.declareValue('::Ice::Communicator') +if "Communicator" not in _M_Ice.__dict__: + _M_Ice._t_Communicator = IcePy.declareValue("::Ice::Communicator") # End of module Ice diff --git a/python/python/Ice/Communicator_local.py b/python/python/Ice/Communicator_local.py index 3322335e661..f6626b2d0e0 100644 --- a/python/python/Ice/Communicator_local.py +++ b/python/python/Ice/Communicator_local.py @@ -30,59 +30,59 @@ import Ice.Connection_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Included module Ice.Instrumentation -_M_Ice.Instrumentation = Ice.openModule('Ice.Instrumentation') +_M_Ice.Instrumentation = Ice.openModule("Ice.Instrumentation") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" _M_Ice.__doc__ = """ The Ice core library. Among many other features, the Ice core library manages all the communication tasks using an efficient protocol (including protocol compression and support for both TCP and UDP), provides a thread pool for multi-threaded servers, and additional functionality that supports high scalability. """ -if 'Communicator' not in _M_Ice.__dict__: +if "Communicator" not in _M_Ice.__dict__: _M_Ice.Communicator = Ice.createTempClass() class Communicator(object): """ - The central object in Ice. One or more communicators can be instantiated for an Ice application. Communicator - instantiation is language-specific, and not specified in Slice code. + The central object in Ice. One or more communicators can be instantiated for an Ice application. Communicator + instantiation is language-specific, and not specified in Slice code. """ def __init__(self): if Ice.getType(self) == _M_Ice.Communicator: - raise RuntimeError('Ice.Communicator is an abstract class') + raise RuntimeError("Ice.Communicator is an abstract class") def destroy(self): """ - Destroy the communicator. This operation calls shutdown implicitly. Calling destroy cleans up - memory, and shuts down this communicator's client functionality and destroys all object adapters. Subsequent - calls to destroy are ignored. + Destroy the communicator. This operation calls shutdown implicitly. Calling destroy cleans up + memory, and shuts down this communicator's client functionality and destroys all object adapters. Subsequent + calls to destroy are ignored. """ raise NotImplementedError("method 'destroy' not implemented") def shutdown(self): """ - Shuts down this communicator's server functionality, which includes the deactivation of all object adapters. - Attempts to use a deactivated object adapter raise ObjectAdapterDeactivatedException. Subsequent calls to - shutdown are ignored. - After shutdown returns, no new requests are processed. However, requests that have been started before shutdown - was called might still be active. You can use waitForShutdown to wait for the completion of all - requests. + Shuts down this communicator's server functionality, which includes the deactivation of all object adapters. + Attempts to use a deactivated object adapter raise ObjectAdapterDeactivatedException. Subsequent calls to + shutdown are ignored. + After shutdown returns, no new requests are processed. However, requests that have been started before shutdown + was called might still be active. You can use waitForShutdown to wait for the completion of all + requests. """ raise NotImplementedError("method 'shutdown' not implemented") def waitForShutdown(self): """ - Wait until the application has called shutdown (or destroy). On the server side, this - operation blocks the calling thread until all currently-executing operations have completed. On the client - side, the operation simply blocks until another thread has called shutdown or destroy. - A typical use of this operation is to call it from the main thread, which then waits until some other thread - calls shutdown. After shut-down is complete, the main thread returns and can do some cleanup work - before it finally calls destroy to shut down the client functionality, and then exits the application. + Wait until the application has called shutdown (or destroy). On the server side, this + operation blocks the calling thread until all currently-executing operations have completed. On the client + side, the operation simply blocks until another thread has called shutdown or destroy. + A typical use of this operation is to call it from the main thread, which then waits until some other thread + calls shutdown. After shut-down is complete, the main thread returns and can do some cleanup work + before it finally calls destroy to shut down the client functionality, and then exits the application. """ raise NotImplementedError("method 'waitForShutdown' not implemented") @@ -172,7 +172,9 @@ def createObjectAdapterWithEndpoints(self, name, endpoints): endpoints -- The endpoints for the object adapter. Returns: The new object adapter. """ - raise NotImplementedError("method 'createObjectAdapterWithEndpoints' not implemented") + raise NotImplementedError( + "method 'createObjectAdapterWithEndpoints' not implemented" + ) def createObjectAdapterWithRouter(self, name, rtr): """ @@ -183,7 +185,9 @@ def createObjectAdapterWithRouter(self, name, rtr): rtr -- The router. Returns: The new object adapter. """ - raise NotImplementedError("method 'createObjectAdapterWithRouter' not implemented") + raise NotImplementedError( + "method 'createObjectAdapterWithRouter' not implemented" + ) def getImplicitContext(self): """ @@ -339,13 +343,15 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Communicator = IcePy.defineValue('::Ice::Communicator', Communicator, -1, (), False, True, None, ()) + _M_Ice._t_Communicator = IcePy.defineValue( + "::Ice::Communicator", Communicator, -1, (), False, True, None, () + ) Communicator._ice_type = _M_Ice._t_Communicator _M_Ice.Communicator = Communicator del Communicator -if 'ToStringMode' not in _M_Ice.__dict__: +if "ToStringMode" not in _M_Ice.__dict__: _M_Ice.ToStringMode = Ice.createTempClass() class ToStringMode(Ice.EnumBase): @@ -371,14 +377,21 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) ToStringMode.Unicode = ToStringMode("Unicode", 0) ToStringMode.ASCII = ToStringMode("ASCII", 1) ToStringMode.Compat = ToStringMode("Compat", 2) - ToStringMode._enumerators = {0: ToStringMode.Unicode, 1: ToStringMode.ASCII, 2: ToStringMode.Compat} - - _M_Ice._t_ToStringMode = IcePy.defineEnum('::Ice::ToStringMode', ToStringMode, (), ToStringMode._enumerators) + ToStringMode._enumerators = { + 0: ToStringMode.Unicode, + 1: ToStringMode.ASCII, + 2: ToStringMode.Compat, + } + + _M_Ice._t_ToStringMode = IcePy.defineEnum( + "::Ice::ToStringMode", ToStringMode, (), ToStringMode._enumerators + ) _M_Ice.ToStringMode = ToStringMode del ToStringMode diff --git a/python/python/Ice/ConnectionF_local.py b/python/python/Ice/ConnectionF_local.py index 8953bb361a8..1d6a733d189 100644 --- a/python/python/Ice/ConnectionF_local.py +++ b/python/python/Ice/ConnectionF_local.py @@ -18,16 +18,16 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'ConnectionInfo' not in _M_Ice.__dict__: - _M_Ice._t_ConnectionInfo = IcePy.declareValue('::Ice::ConnectionInfo') +if "ConnectionInfo" not in _M_Ice.__dict__: + _M_Ice._t_ConnectionInfo = IcePy.declareValue("::Ice::ConnectionInfo") -if 'WSConnectionInfo' not in _M_Ice.__dict__: - _M_Ice._t_WSConnectionInfo = IcePy.declareValue('::Ice::WSConnectionInfo') +if "WSConnectionInfo" not in _M_Ice.__dict__: + _M_Ice._t_WSConnectionInfo = IcePy.declareValue("::Ice::WSConnectionInfo") -if 'Connection' not in _M_Ice.__dict__: - _M_Ice._t_Connection = IcePy.declareValue('::Ice::Connection') +if "Connection" not in _M_Ice.__dict__: + _M_Ice._t_Connection = IcePy.declareValue("::Ice::Connection") # End of module Ice diff --git a/python/python/Ice/Connection_local.py b/python/python/Ice/Connection_local.py index 4fa2d64ccf3..c21f6d054eb 100644 --- a/python/python/Ice/Connection_local.py +++ b/python/python/Ice/Connection_local.py @@ -21,12 +21,12 @@ import Ice.Endpoint_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'CompressBatch' not in _M_Ice.__dict__: +if "CompressBatch" not in _M_Ice.__dict__: _M_Ice.CompressBatch = Ice.createTempClass() class CompressBatch(Ice.EnumBase): @@ -45,19 +45,26 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) CompressBatch.Yes = CompressBatch("Yes", 0) CompressBatch.No = CompressBatch("No", 1) CompressBatch.BasedOnProxy = CompressBatch("BasedOnProxy", 2) - CompressBatch._enumerators = {0: CompressBatch.Yes, 1: CompressBatch.No, 2: CompressBatch.BasedOnProxy} + CompressBatch._enumerators = { + 0: CompressBatch.Yes, + 1: CompressBatch.No, + 2: CompressBatch.BasedOnProxy, + } - _M_Ice._t_CompressBatch = IcePy.defineEnum('::Ice::CompressBatch', CompressBatch, (), CompressBatch._enumerators) + _M_Ice._t_CompressBatch = IcePy.defineEnum( + "::Ice::CompressBatch", CompressBatch, (), CompressBatch._enumerators + ) _M_Ice.CompressBatch = CompressBatch del CompressBatch -if 'ConnectionInfo' not in _M_Ice.__dict__: +if "ConnectionInfo" not in _M_Ice.__dict__: _M_Ice.ConnectionInfo = Ice.createTempClass() class ConnectionInfo(object): @@ -70,7 +77,9 @@ class ConnectionInfo(object): connectionId -- The connection id. """ - def __init__(self, underlying=None, incoming=False, adapterName='', connectionId=''): + def __init__( + self, underlying=None, incoming=False, adapterName="", connectionId="" + ): self.underlying = underlying self.incoming = incoming self.adapterName = adapterName @@ -81,33 +90,42 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_ConnectionInfo = IcePy.declareValue('::Ice::ConnectionInfo') - - _M_Ice._t_ConnectionInfo = IcePy.defineValue('::Ice::ConnectionInfo', ConnectionInfo, -1, (), False, False, None, ( - ('underlying', (), _M_Ice._t_ConnectionInfo, False, 0), - ('incoming', (), IcePy._t_bool, False, 0), - ('adapterName', (), IcePy._t_string, False, 0), - ('connectionId', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_ConnectionInfo = IcePy.declareValue("::Ice::ConnectionInfo") + + _M_Ice._t_ConnectionInfo = IcePy.defineValue( + "::Ice::ConnectionInfo", + ConnectionInfo, + -1, + (), + False, + False, + None, + ( + ("underlying", (), _M_Ice._t_ConnectionInfo, False, 0), + ("incoming", (), IcePy._t_bool, False, 0), + ("adapterName", (), IcePy._t_string, False, 0), + ("connectionId", (), IcePy._t_string, False, 0), + ), + ) ConnectionInfo._ice_type = _M_Ice._t_ConnectionInfo _M_Ice.ConnectionInfo = ConnectionInfo del ConnectionInfo -if 'Connection' not in _M_Ice.__dict__: - _M_Ice._t_Connection = IcePy.declareValue('::Ice::Connection') +if "Connection" not in _M_Ice.__dict__: + _M_Ice._t_Connection = IcePy.declareValue("::Ice::Connection") -if 'CloseCallback' not in _M_Ice.__dict__: +if "CloseCallback" not in _M_Ice.__dict__: _M_Ice.CloseCallback = Ice.createTempClass() class CloseCallback(object): """ - An application can implement this interface to receive notifications when a connection closes. + An application can implement this interface to receive notifications when a connection closes. """ def __init__(self): if Ice.getType(self) == _M_Ice.CloseCallback: - raise RuntimeError('Ice.CloseCallback is an abstract class') + raise RuntimeError("Ice.CloseCallback is an abstract class") def closed(self, con): """ @@ -123,24 +141,26 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_CloseCallback = IcePy.defineValue('::Ice::CloseCallback', CloseCallback, -1, (), False, True, None, ()) + _M_Ice._t_CloseCallback = IcePy.defineValue( + "::Ice::CloseCallback", CloseCallback, -1, (), False, True, None, () + ) CloseCallback._ice_type = _M_Ice._t_CloseCallback _M_Ice.CloseCallback = CloseCallback del CloseCallback -if 'HeartbeatCallback' not in _M_Ice.__dict__: +if "HeartbeatCallback" not in _M_Ice.__dict__: _M_Ice.HeartbeatCallback = Ice.createTempClass() class HeartbeatCallback(object): """ - An application can implement this interface to receive notifications when a connection receives a heartbeat - message. + An application can implement this interface to receive notifications when a connection receives a heartbeat + message. """ def __init__(self): if Ice.getType(self) == _M_Ice.HeartbeatCallback: - raise RuntimeError('Ice.HeartbeatCallback is an abstract class') + raise RuntimeError("Ice.HeartbeatCallback is an abstract class") def heartbeat(self, con): """ @@ -156,13 +176,14 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_HeartbeatCallback = IcePy.defineValue( - '::Ice::HeartbeatCallback', HeartbeatCallback, -1, (), False, True, None, ()) + "::Ice::HeartbeatCallback", HeartbeatCallback, -1, (), False, True, None, () + ) HeartbeatCallback._ice_type = _M_Ice._t_HeartbeatCallback _M_Ice.HeartbeatCallback = HeartbeatCallback del HeartbeatCallback -if 'ACMClose' not in _M_Ice.__dict__: +if "ACMClose" not in _M_Ice.__dict__: _M_Ice.ACMClose = Ice.createTempClass() class ACMClose(Ice.EnumBase): @@ -185,6 +206,7 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) ACMClose.CloseOff = ACMClose("CloseOff", 0) @@ -192,15 +214,22 @@ def valueOf(self, _n): ACMClose.CloseOnInvocation = ACMClose("CloseOnInvocation", 2) ACMClose.CloseOnInvocationAndIdle = ACMClose("CloseOnInvocationAndIdle", 3) ACMClose.CloseOnIdleForceful = ACMClose("CloseOnIdleForceful", 4) - ACMClose._enumerators = {0: ACMClose.CloseOff, 1: ACMClose.CloseOnIdle, 2: ACMClose.CloseOnInvocation, - 3: ACMClose.CloseOnInvocationAndIdle, 4: ACMClose.CloseOnIdleForceful} - - _M_Ice._t_ACMClose = IcePy.defineEnum('::Ice::ACMClose', ACMClose, (), ACMClose._enumerators) + ACMClose._enumerators = { + 0: ACMClose.CloseOff, + 1: ACMClose.CloseOnIdle, + 2: ACMClose.CloseOnInvocation, + 3: ACMClose.CloseOnInvocationAndIdle, + 4: ACMClose.CloseOnIdleForceful, + } + + _M_Ice._t_ACMClose = IcePy.defineEnum( + "::Ice::ACMClose", ACMClose, (), ACMClose._enumerators + ) _M_Ice.ACMClose = ACMClose del ACMClose -if 'ACMHeartbeat' not in _M_Ice.__dict__: +if "ACMHeartbeat" not in _M_Ice.__dict__: _M_Ice.ACMHeartbeat = Ice.createTempClass() class ACMHeartbeat(Ice.EnumBase): @@ -220,21 +249,28 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) ACMHeartbeat.HeartbeatOff = ACMHeartbeat("HeartbeatOff", 0) ACMHeartbeat.HeartbeatOnDispatch = ACMHeartbeat("HeartbeatOnDispatch", 1) ACMHeartbeat.HeartbeatOnIdle = ACMHeartbeat("HeartbeatOnIdle", 2) ACMHeartbeat.HeartbeatAlways = ACMHeartbeat("HeartbeatAlways", 3) - ACMHeartbeat._enumerators = {0: ACMHeartbeat.HeartbeatOff, 1: ACMHeartbeat.HeartbeatOnDispatch, - 2: ACMHeartbeat.HeartbeatOnIdle, 3: ACMHeartbeat.HeartbeatAlways} + ACMHeartbeat._enumerators = { + 0: ACMHeartbeat.HeartbeatOff, + 1: ACMHeartbeat.HeartbeatOnDispatch, + 2: ACMHeartbeat.HeartbeatOnIdle, + 3: ACMHeartbeat.HeartbeatAlways, + } - _M_Ice._t_ACMHeartbeat = IcePy.defineEnum('::Ice::ACMHeartbeat', ACMHeartbeat, (), ACMHeartbeat._enumerators) + _M_Ice._t_ACMHeartbeat = IcePy.defineEnum( + "::Ice::ACMHeartbeat", ACMHeartbeat, (), ACMHeartbeat._enumerators + ) _M_Ice.ACMHeartbeat = ACMHeartbeat del ACMHeartbeat -if 'ACM' not in _M_Ice.__dict__: +if "ACM" not in _M_Ice.__dict__: _M_Ice.ACM = Ice.createTempClass() class ACM(object): @@ -246,7 +282,12 @@ class ACM(object): heartbeat -- The heartbeat semantics. """ - def __init__(self, timeout=0, close=_M_Ice.ACMClose.CloseOff, heartbeat=_M_Ice.ACMHeartbeat.HeartbeatOff): + def __init__( + self, + timeout=0, + close=_M_Ice.ACMClose.CloseOff, + heartbeat=_M_Ice.ACMHeartbeat.HeartbeatOff, + ): self.timeout = timeout self.close = close self.heartbeat = heartbeat @@ -256,7 +297,7 @@ def __hash__(self): _h = 5 * _h + Ice.getHash(self.timeout) _h = 5 * _h + Ice.getHash(self.close) _h = 5 * _h + Ice.getHash(self.heartbeat) - return _h % 0x7fffffff + return _h % 0x7FFFFFFF def __compare(self, other): if other is None: @@ -266,7 +307,7 @@ def __compare(self, other): else: if self.timeout is None or other.timeout is None: if self.timeout != other.timeout: - return (-1 if self.timeout is None else 1) + return -1 if self.timeout is None else 1 else: if self.timeout < other.timeout: return -1 @@ -274,7 +315,7 @@ def __compare(self, other): return 1 if self.close is None or other.close is None: if self.close != other.close: - return (-1 if self.close is None else 1) + return -1 if self.close is None else 1 else: if self.close < other.close: return -1 @@ -282,7 +323,7 @@ def __compare(self, other): return 1 if self.heartbeat is None or other.heartbeat is None: if self.heartbeat != other.heartbeat: - return (-1 if self.heartbeat is None else 1) + return -1 if self.heartbeat is None else 1 else: if self.heartbeat < other.heartbeat: return -1 @@ -337,16 +378,21 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_ACM = IcePy.defineStruct('::Ice::ACM', ACM, (), ( - ('timeout', (), IcePy._t_int), - ('close', (), _M_Ice._t_ACMClose), - ('heartbeat', (), _M_Ice._t_ACMHeartbeat) - )) + _M_Ice._t_ACM = IcePy.defineStruct( + "::Ice::ACM", + ACM, + (), + ( + ("timeout", (), IcePy._t_int), + ("close", (), _M_Ice._t_ACMClose), + ("heartbeat", (), _M_Ice._t_ACMHeartbeat), + ), + ) _M_Ice.ACM = ACM del ACM -if 'ConnectionClose' not in _M_Ice.__dict__: +if "ConnectionClose" not in _M_Ice.__dict__: _M_Ice.ConnectionClose = Ice.createTempClass() class ConnectionClose(Ice.EnumBase): @@ -367,31 +413,36 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) ConnectionClose.Forcefully = ConnectionClose("Forcefully", 0) ConnectionClose.Gracefully = ConnectionClose("Gracefully", 1) ConnectionClose.GracefullyWithWait = ConnectionClose("GracefullyWithWait", 2) - ConnectionClose._enumerators = {0: ConnectionClose.Forcefully, - 1: ConnectionClose.Gracefully, 2: ConnectionClose.GracefullyWithWait} + ConnectionClose._enumerators = { + 0: ConnectionClose.Forcefully, + 1: ConnectionClose.Gracefully, + 2: ConnectionClose.GracefullyWithWait, + } _M_Ice._t_ConnectionClose = IcePy.defineEnum( - '::Ice::ConnectionClose', ConnectionClose, (), ConnectionClose._enumerators) + "::Ice::ConnectionClose", ConnectionClose, (), ConnectionClose._enumerators + ) _M_Ice.ConnectionClose = ConnectionClose del ConnectionClose -if 'Connection' not in _M_Ice.__dict__: +if "Connection" not in _M_Ice.__dict__: _M_Ice.Connection = Ice.createTempClass() class Connection(object): """ - The user-level interface to a connection. + The user-level interface to a connection. """ def __init__(self): if Ice.getType(self) == _M_Ice.Connection: - raise RuntimeError('Ice.Connection is an abstract class') + raise RuntimeError("Ice.Connection is an abstract class") def close(self, mode): """ @@ -467,7 +518,7 @@ def setHeartbeatCallback(self, callback): def heartbeat(self): """ - Send a heartbeat message. + Send a heartbeat message. """ raise NotImplementedError("method 'heartbeat' not implemented") @@ -527,10 +578,10 @@ def setBufferSize(self, rcvSize, sndSize): def throwException(self): """ - Throw an exception indicating the reason for connection closure. For example, - CloseConnectionException is raised if the connection was closed gracefully, whereas - ConnectionManuallyClosedException is raised if the connection was manually closed by - the application. This operation does nothing if the connection is not yet closed. + Throw an exception indicating the reason for connection closure. For example, + CloseConnectionException is raised if the connection was closed gracefully, whereas + ConnectionManuallyClosedException is raised if the connection was manually closed by + the application. This operation does nothing if the connection is not yet closed. """ raise NotImplementedError("method 'throwException' not implemented") @@ -539,13 +590,15 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Connection = IcePy.defineValue('::Ice::Connection', Connection, -1, (), False, True, None, ()) + _M_Ice._t_Connection = IcePy.defineValue( + "::Ice::Connection", Connection, -1, (), False, True, None, () + ) Connection._ice_type = _M_Ice._t_Connection _M_Ice.Connection = Connection del Connection -if 'IPConnectionInfo' not in _M_Ice.__dict__: +if "IPConnectionInfo" not in _M_Ice.__dict__: _M_Ice.IPConnectionInfo = Ice.createTempClass() class IPConnectionInfo(_M_Ice.ConnectionInfo): @@ -558,8 +611,20 @@ class IPConnectionInfo(_M_Ice.ConnectionInfo): remotePort -- The remote port. """ - def __init__(self, underlying=None, incoming=False, adapterName='', connectionId='', localAddress="", localPort=-1, remoteAddress="", remotePort=-1): - _M_Ice.ConnectionInfo.__init__(self, underlying, incoming, adapterName, connectionId) + def __init__( + self, + underlying=None, + incoming=False, + adapterName="", + connectionId="", + localAddress="", + localPort=-1, + remoteAddress="", + remotePort=-1, + ): + _M_Ice.ConnectionInfo.__init__( + self, underlying, incoming, adapterName, connectionId + ) self.localAddress = localAddress self.localPort = localPort self.remoteAddress = remoteAddress @@ -570,20 +635,29 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_IPConnectionInfo = IcePy.declareValue('::Ice::IPConnectionInfo') - - _M_Ice._t_IPConnectionInfo = IcePy.defineValue('::Ice::IPConnectionInfo', IPConnectionInfo, -1, (), False, False, _M_Ice._t_ConnectionInfo, ( - ('localAddress', (), IcePy._t_string, False, 0), - ('localPort', (), IcePy._t_int, False, 0), - ('remoteAddress', (), IcePy._t_string, False, 0), - ('remotePort', (), IcePy._t_int, False, 0) - )) + _M_Ice._t_IPConnectionInfo = IcePy.declareValue("::Ice::IPConnectionInfo") + + _M_Ice._t_IPConnectionInfo = IcePy.defineValue( + "::Ice::IPConnectionInfo", + IPConnectionInfo, + -1, + (), + False, + False, + _M_Ice._t_ConnectionInfo, + ( + ("localAddress", (), IcePy._t_string, False, 0), + ("localPort", (), IcePy._t_int, False, 0), + ("remoteAddress", (), IcePy._t_string, False, 0), + ("remotePort", (), IcePy._t_int, False, 0), + ), + ) IPConnectionInfo._ice_type = _M_Ice._t_IPConnectionInfo _M_Ice.IPConnectionInfo = IPConnectionInfo del IPConnectionInfo -if 'TCPConnectionInfo' not in _M_Ice.__dict__: +if "TCPConnectionInfo" not in _M_Ice.__dict__: _M_Ice.TCPConnectionInfo = Ice.createTempClass() class TCPConnectionInfo(_M_Ice.IPConnectionInfo): @@ -594,9 +668,30 @@ class TCPConnectionInfo(_M_Ice.IPConnectionInfo): sndSize -- The connection buffer send size. """ - def __init__(self, underlying=None, incoming=False, adapterName='', connectionId='', localAddress="", localPort=-1, remoteAddress="", remotePort=-1, rcvSize=0, sndSize=0): - _M_Ice.IPConnectionInfo.__init__(self, underlying, incoming, adapterName, - connectionId, localAddress, localPort, remoteAddress, remotePort) + def __init__( + self, + underlying=None, + incoming=False, + adapterName="", + connectionId="", + localAddress="", + localPort=-1, + remoteAddress="", + remotePort=-1, + rcvSize=0, + sndSize=0, + ): + _M_Ice.IPConnectionInfo.__init__( + self, + underlying, + incoming, + adapterName, + connectionId, + localAddress, + localPort, + remoteAddress, + remotePort, + ) self.rcvSize = rcvSize self.sndSize = sndSize @@ -605,18 +700,27 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_TCPConnectionInfo = IcePy.declareValue('::Ice::TCPConnectionInfo') - - _M_Ice._t_TCPConnectionInfo = IcePy.defineValue('::Ice::TCPConnectionInfo', TCPConnectionInfo, -1, (), False, False, _M_Ice._t_IPConnectionInfo, ( - ('rcvSize', (), IcePy._t_int, False, 0), - ('sndSize', (), IcePy._t_int, False, 0) - )) + _M_Ice._t_TCPConnectionInfo = IcePy.declareValue("::Ice::TCPConnectionInfo") + + _M_Ice._t_TCPConnectionInfo = IcePy.defineValue( + "::Ice::TCPConnectionInfo", + TCPConnectionInfo, + -1, + (), + False, + False, + _M_Ice._t_IPConnectionInfo, + ( + ("rcvSize", (), IcePy._t_int, False, 0), + ("sndSize", (), IcePy._t_int, False, 0), + ), + ) TCPConnectionInfo._ice_type = _M_Ice._t_TCPConnectionInfo _M_Ice.TCPConnectionInfo = TCPConnectionInfo del TCPConnectionInfo -if 'UDPConnectionInfo' not in _M_Ice.__dict__: +if "UDPConnectionInfo" not in _M_Ice.__dict__: _M_Ice.UDPConnectionInfo = Ice.createTempClass() class UDPConnectionInfo(_M_Ice.IPConnectionInfo): @@ -629,9 +733,32 @@ class UDPConnectionInfo(_M_Ice.IPConnectionInfo): sndSize -- The connection buffer send size. """ - def __init__(self, underlying=None, incoming=False, adapterName='', connectionId='', localAddress="", localPort=-1, remoteAddress="", remotePort=-1, mcastAddress='', mcastPort=-1, rcvSize=0, sndSize=0): - _M_Ice.IPConnectionInfo.__init__(self, underlying, incoming, adapterName, - connectionId, localAddress, localPort, remoteAddress, remotePort) + def __init__( + self, + underlying=None, + incoming=False, + adapterName="", + connectionId="", + localAddress="", + localPort=-1, + remoteAddress="", + remotePort=-1, + mcastAddress="", + mcastPort=-1, + rcvSize=0, + sndSize=0, + ): + _M_Ice.IPConnectionInfo.__init__( + self, + underlying, + incoming, + adapterName, + connectionId, + localAddress, + localPort, + remoteAddress, + remotePort, + ) self.mcastAddress = mcastAddress self.mcastPort = mcastPort self.rcvSize = rcvSize @@ -642,23 +769,34 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_UDPConnectionInfo = IcePy.declareValue('::Ice::UDPConnectionInfo') - - _M_Ice._t_UDPConnectionInfo = IcePy.defineValue('::Ice::UDPConnectionInfo', UDPConnectionInfo, -1, (), False, False, _M_Ice._t_IPConnectionInfo, ( - ('mcastAddress', (), IcePy._t_string, False, 0), - ('mcastPort', (), IcePy._t_int, False, 0), - ('rcvSize', (), IcePy._t_int, False, 0), - ('sndSize', (), IcePy._t_int, False, 0) - )) + _M_Ice._t_UDPConnectionInfo = IcePy.declareValue("::Ice::UDPConnectionInfo") + + _M_Ice._t_UDPConnectionInfo = IcePy.defineValue( + "::Ice::UDPConnectionInfo", + UDPConnectionInfo, + -1, + (), + False, + False, + _M_Ice._t_IPConnectionInfo, + ( + ("mcastAddress", (), IcePy._t_string, False, 0), + ("mcastPort", (), IcePy._t_int, False, 0), + ("rcvSize", (), IcePy._t_int, False, 0), + ("sndSize", (), IcePy._t_int, False, 0), + ), + ) UDPConnectionInfo._ice_type = _M_Ice._t_UDPConnectionInfo _M_Ice.UDPConnectionInfo = UDPConnectionInfo del UDPConnectionInfo -if '_t_HeaderDict' not in _M_Ice.__dict__: - _M_Ice._t_HeaderDict = IcePy.defineDictionary('::Ice::HeaderDict', (), IcePy._t_string, IcePy._t_string) +if "_t_HeaderDict" not in _M_Ice.__dict__: + _M_Ice._t_HeaderDict = IcePy.defineDictionary( + "::Ice::HeaderDict", (), IcePy._t_string, IcePy._t_string + ) -if 'WSConnectionInfo' not in _M_Ice.__dict__: +if "WSConnectionInfo" not in _M_Ice.__dict__: _M_Ice.WSConnectionInfo = Ice.createTempClass() class WSConnectionInfo(_M_Ice.ConnectionInfo): @@ -668,8 +806,17 @@ class WSConnectionInfo(_M_Ice.ConnectionInfo): headers -- The headers from the HTTP upgrade request. """ - def __init__(self, underlying=None, incoming=False, adapterName='', connectionId='', headers=None): - _M_Ice.ConnectionInfo.__init__(self, underlying, incoming, adapterName, connectionId) + def __init__( + self, + underlying=None, + incoming=False, + adapterName="", + connectionId="", + headers=None, + ): + _M_Ice.ConnectionInfo.__init__( + self, underlying, incoming, adapterName, connectionId + ) self.headers = headers def __str__(self): @@ -677,10 +824,18 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_WSConnectionInfo = IcePy.declareValue('::Ice::WSConnectionInfo') - - _M_Ice._t_WSConnectionInfo = IcePy.defineValue('::Ice::WSConnectionInfo', WSConnectionInfo, -1, - (), False, False, _M_Ice._t_ConnectionInfo, (('headers', (), _M_Ice._t_HeaderDict, False, 0),)) + _M_Ice._t_WSConnectionInfo = IcePy.declareValue("::Ice::WSConnectionInfo") + + _M_Ice._t_WSConnectionInfo = IcePy.defineValue( + "::Ice::WSConnectionInfo", + WSConnectionInfo, + -1, + (), + False, + False, + _M_Ice._t_ConnectionInfo, + (("headers", (), _M_Ice._t_HeaderDict, False, 0),), + ) WSConnectionInfo._ice_type = _M_Ice._t_WSConnectionInfo _M_Ice.WSConnectionInfo = WSConnectionInfo diff --git a/python/python/Ice/Current_local.py b/python/python/Ice/Current_local.py index 7e7a36cc6e4..4343b559f12 100644 --- a/python/python/Ice/Current_local.py +++ b/python/python/Ice/Current_local.py @@ -24,12 +24,12 @@ import Ice.Version_ice # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'Current' not in _M_Ice.__dict__: +if "Current" not in _M_Ice.__dict__: _M_Ice.Current = Ice.createTempClass() class Current(object): @@ -50,7 +50,18 @@ class Current(object): encoding -- The encoding version used to encode the input and output parameters. """ - def __init__(self, adapter=None, con=None, id=Ice._struct_marker, facet='', operation='', mode=_M_Ice.OperationMode.Normal, ctx=None, requestId=0, encoding=Ice._struct_marker): + def __init__( + self, + adapter=None, + con=None, + id=Ice._struct_marker, + facet="", + operation="", + mode=_M_Ice.OperationMode.Normal, + ctx=None, + requestId=0, + encoding=Ice._struct_marker, + ): self.adapter = adapter self.con = con if id is Ice._struct_marker: @@ -101,17 +112,22 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Current = IcePy.defineStruct('::Ice::Current', Current, (), ( - ('adapter', (), _M_Ice._t_ObjectAdapter), - ('con', (), _M_Ice._t_Connection), - ('id', (), _M_Ice._t_Identity), - ('facet', (), IcePy._t_string), - ('operation', (), IcePy._t_string), - ('mode', (), _M_Ice._t_OperationMode), - ('ctx', (), _M_Ice._t_Context), - ('requestId', (), IcePy._t_int), - ('encoding', (), _M_Ice._t_EncodingVersion) - )) + _M_Ice._t_Current = IcePy.defineStruct( + "::Ice::Current", + Current, + (), + ( + ("adapter", (), _M_Ice._t_ObjectAdapter), + ("con", (), _M_Ice._t_Connection), + ("id", (), _M_Ice._t_Identity), + ("facet", (), IcePy._t_string), + ("operation", (), IcePy._t_string), + ("mode", (), _M_Ice._t_OperationMode), + ("ctx", (), _M_Ice._t_Context), + ("requestId", (), IcePy._t_int), + ("encoding", (), _M_Ice._t_EncodingVersion), + ), + ) _M_Ice.Current = Current del Current diff --git a/python/python/Ice/EndpointF_local.py b/python/python/Ice/EndpointF_local.py index 4c8b1b9ddb2..daede9053e4 100644 --- a/python/python/Ice/EndpointF_local.py +++ b/python/python/Ice/EndpointF_local.py @@ -18,28 +18,30 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'EndpointInfo' not in _M_Ice.__dict__: - _M_Ice._t_EndpointInfo = IcePy.declareValue('::Ice::EndpointInfo') +if "EndpointInfo" not in _M_Ice.__dict__: + _M_Ice._t_EndpointInfo = IcePy.declareValue("::Ice::EndpointInfo") -if 'IPEndpointInfo' not in _M_Ice.__dict__: - _M_Ice._t_IPEndpointInfo = IcePy.declareValue('::Ice::IPEndpointInfo') +if "IPEndpointInfo" not in _M_Ice.__dict__: + _M_Ice._t_IPEndpointInfo = IcePy.declareValue("::Ice::IPEndpointInfo") -if 'TCPEndpointInfo' not in _M_Ice.__dict__: - _M_Ice._t_TCPEndpointInfo = IcePy.declareValue('::Ice::TCPEndpointInfo') +if "TCPEndpointInfo" not in _M_Ice.__dict__: + _M_Ice._t_TCPEndpointInfo = IcePy.declareValue("::Ice::TCPEndpointInfo") -if 'UDPEndpointInfo' not in _M_Ice.__dict__: - _M_Ice._t_UDPEndpointInfo = IcePy.declareValue('::Ice::UDPEndpointInfo') +if "UDPEndpointInfo" not in _M_Ice.__dict__: + _M_Ice._t_UDPEndpointInfo = IcePy.declareValue("::Ice::UDPEndpointInfo") -if 'WSEndpointInfo' not in _M_Ice.__dict__: - _M_Ice._t_WSEndpointInfo = IcePy.declareValue('::Ice::WSEndpointInfo') +if "WSEndpointInfo" not in _M_Ice.__dict__: + _M_Ice._t_WSEndpointInfo = IcePy.declareValue("::Ice::WSEndpointInfo") -if 'Endpoint' not in _M_Ice.__dict__: - _M_Ice._t_Endpoint = IcePy.declareValue('::Ice::Endpoint') +if "Endpoint" not in _M_Ice.__dict__: + _M_Ice._t_Endpoint = IcePy.declareValue("::Ice::Endpoint") -if '_t_EndpointSeq' not in _M_Ice.__dict__: - _M_Ice._t_EndpointSeq = IcePy.defineSequence('::Ice::EndpointSeq', (), _M_Ice._t_Endpoint) +if "_t_EndpointSeq" not in _M_Ice.__dict__: + _M_Ice._t_EndpointSeq = IcePy.defineSequence( + "::Ice::EndpointSeq", (), _M_Ice._t_Endpoint + ) # End of module Ice diff --git a/python/python/Ice/EndpointSelectionType_local.py b/python/python/Ice/EndpointSelectionType_local.py index c41a4006290..00db2eca1a1 100644 --- a/python/python/Ice/EndpointSelectionType_local.py +++ b/python/python/Ice/EndpointSelectionType_local.py @@ -18,10 +18,10 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'EndpointSelectionType' not in _M_Ice.__dict__: +if "EndpointSelectionType" not in _M_Ice.__dict__: _M_Ice.EndpointSelectionType = Ice.createTempClass() class EndpointSelectionType(Ice.EnumBase): @@ -39,14 +39,22 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) EndpointSelectionType.Random = EndpointSelectionType("Random", 0) EndpointSelectionType.Ordered = EndpointSelectionType("Ordered", 1) - EndpointSelectionType._enumerators = {0: EndpointSelectionType.Random, 1: EndpointSelectionType.Ordered} + EndpointSelectionType._enumerators = { + 0: EndpointSelectionType.Random, + 1: EndpointSelectionType.Ordered, + } _M_Ice._t_EndpointSelectionType = IcePy.defineEnum( - '::Ice::EndpointSelectionType', EndpointSelectionType, (), EndpointSelectionType._enumerators) + "::Ice::EndpointSelectionType", + EndpointSelectionType, + (), + EndpointSelectionType._enumerators, + ) _M_Ice.EndpointSelectionType = EndpointSelectionType del EndpointSelectionType diff --git a/python/python/Ice/Endpoint_local.py b/python/python/Ice/Endpoint_local.py index fc5a8ae35a5..a977662489b 100644 --- a/python/python/Ice/Endpoint_local.py +++ b/python/python/Ice/Endpoint_local.py @@ -21,12 +21,12 @@ import Ice.EndpointF_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'EndpointInfo' not in _M_Ice.__dict__: +if "EndpointInfo" not in _M_Ice.__dict__: _M_Ice.EndpointInfo = Ice.createTempClass() class EndpointInfo(object): @@ -40,7 +40,7 @@ class EndpointInfo(object): def __init__(self, underlying=None, timeout=0, compress=False): if Ice.getType(self) == _M_Ice.EndpointInfo: - raise RuntimeError('Ice.EndpointInfo is an abstract class') + raise RuntimeError("Ice.EndpointInfo is an abstract class") self.underlying = underlying self.timeout = timeout self.compress = compress @@ -70,29 +70,38 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_EndpointInfo = IcePy.declareValue('::Ice::EndpointInfo') - - _M_Ice._t_EndpointInfo = IcePy.defineValue('::Ice::EndpointInfo', EndpointInfo, -1, (), False, False, None, ( - ('underlying', (), _M_Ice._t_EndpointInfo, False, 0), - ('timeout', (), IcePy._t_int, False, 0), - ('compress', (), IcePy._t_bool, False, 0) - )) + _M_Ice._t_EndpointInfo = IcePy.declareValue("::Ice::EndpointInfo") + + _M_Ice._t_EndpointInfo = IcePy.defineValue( + "::Ice::EndpointInfo", + EndpointInfo, + -1, + (), + False, + False, + None, + ( + ("underlying", (), _M_Ice._t_EndpointInfo, False, 0), + ("timeout", (), IcePy._t_int, False, 0), + ("compress", (), IcePy._t_bool, False, 0), + ), + ) EndpointInfo._ice_type = _M_Ice._t_EndpointInfo _M_Ice.EndpointInfo = EndpointInfo del EndpointInfo -if 'Endpoint' not in _M_Ice.__dict__: +if "Endpoint" not in _M_Ice.__dict__: _M_Ice.Endpoint = Ice.createTempClass() class Endpoint(object): """ - The user-level interface to an endpoint. + The user-level interface to an endpoint. """ def __init__(self): if Ice.getType(self) == _M_Ice.Endpoint: - raise RuntimeError('Ice.Endpoint is an abstract class') + raise RuntimeError("Ice.Endpoint is an abstract class") def toString(self): """ @@ -113,13 +122,15 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Endpoint = IcePy.defineValue('::Ice::Endpoint', Endpoint, -1, (), False, True, None, ()) + _M_Ice._t_Endpoint = IcePy.defineValue( + "::Ice::Endpoint", Endpoint, -1, (), False, True, None, () + ) Endpoint._ice_type = _M_Ice._t_Endpoint _M_Ice.Endpoint = Endpoint del Endpoint -if 'IPEndpointInfo' not in _M_Ice.__dict__: +if "IPEndpointInfo" not in _M_Ice.__dict__: _M_Ice.IPEndpointInfo = Ice.createTempClass() class IPEndpointInfo(_M_Ice.EndpointInfo): @@ -131,9 +142,17 @@ class IPEndpointInfo(_M_Ice.EndpointInfo): sourceAddress -- The source IP address. """ - def __init__(self, underlying=None, timeout=0, compress=False, host='', port=0, sourceAddress=''): + def __init__( + self, + underlying=None, + timeout=0, + compress=False, + host="", + port=0, + sourceAddress="", + ): if Ice.getType(self) == _M_Ice.IPEndpointInfo: - raise RuntimeError('Ice.IPEndpointInfo is an abstract class') + raise RuntimeError("Ice.IPEndpointInfo is an abstract class") _M_Ice.EndpointInfo.__init__(self, underlying, timeout, compress) self.host = host self.port = port @@ -144,46 +163,73 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_IPEndpointInfo = IcePy.declareValue('::Ice::IPEndpointInfo') - - _M_Ice._t_IPEndpointInfo = IcePy.defineValue('::Ice::IPEndpointInfo', IPEndpointInfo, -1, (), False, False, _M_Ice._t_EndpointInfo, ( - ('host', (), IcePy._t_string, False, 0), - ('port', (), IcePy._t_int, False, 0), - ('sourceAddress', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_IPEndpointInfo = IcePy.declareValue("::Ice::IPEndpointInfo") + + _M_Ice._t_IPEndpointInfo = IcePy.defineValue( + "::Ice::IPEndpointInfo", + IPEndpointInfo, + -1, + (), + False, + False, + _M_Ice._t_EndpointInfo, + ( + ("host", (), IcePy._t_string, False, 0), + ("port", (), IcePy._t_int, False, 0), + ("sourceAddress", (), IcePy._t_string, False, 0), + ), + ) IPEndpointInfo._ice_type = _M_Ice._t_IPEndpointInfo _M_Ice.IPEndpointInfo = IPEndpointInfo del IPEndpointInfo -if 'TCPEndpointInfo' not in _M_Ice.__dict__: +if "TCPEndpointInfo" not in _M_Ice.__dict__: _M_Ice.TCPEndpointInfo = Ice.createTempClass() class TCPEndpointInfo(_M_Ice.IPEndpointInfo): """ - Provides access to a TCP endpoint information. + Provides access to a TCP endpoint information. """ - def __init__(self, underlying=None, timeout=0, compress=False, host='', port=0, sourceAddress=''): + def __init__( + self, + underlying=None, + timeout=0, + compress=False, + host="", + port=0, + sourceAddress="", + ): if Ice.getType(self) == _M_Ice.TCPEndpointInfo: - raise RuntimeError('Ice.TCPEndpointInfo is an abstract class') - _M_Ice.IPEndpointInfo.__init__(self, underlying, timeout, compress, host, port, sourceAddress) + raise RuntimeError("Ice.TCPEndpointInfo is an abstract class") + _M_Ice.IPEndpointInfo.__init__( + self, underlying, timeout, compress, host, port, sourceAddress + ) def __str__(self): return IcePy.stringify(self, _M_Ice._t_TCPEndpointInfo) __repr__ = __str__ - _M_Ice._t_TCPEndpointInfo = IcePy.declareValue('::Ice::TCPEndpointInfo') + _M_Ice._t_TCPEndpointInfo = IcePy.declareValue("::Ice::TCPEndpointInfo") _M_Ice._t_TCPEndpointInfo = IcePy.defineValue( - '::Ice::TCPEndpointInfo', TCPEndpointInfo, -1, (), False, False, _M_Ice._t_IPEndpointInfo, ()) + "::Ice::TCPEndpointInfo", + TCPEndpointInfo, + -1, + (), + False, + False, + _M_Ice._t_IPEndpointInfo, + (), + ) TCPEndpointInfo._ice_type = _M_Ice._t_TCPEndpointInfo _M_Ice.TCPEndpointInfo = TCPEndpointInfo del TCPEndpointInfo -if 'UDPEndpointInfo' not in _M_Ice.__dict__: +if "UDPEndpointInfo" not in _M_Ice.__dict__: _M_Ice.UDPEndpointInfo = Ice.createTempClass() class UDPEndpointInfo(_M_Ice.IPEndpointInfo): @@ -194,10 +240,22 @@ class UDPEndpointInfo(_M_Ice.IPEndpointInfo): mcastTtl -- The multicast time-to-live (or hops). """ - def __init__(self, underlying=None, timeout=0, compress=False, host='', port=0, sourceAddress='', mcastInterface='', mcastTtl=0): + def __init__( + self, + underlying=None, + timeout=0, + compress=False, + host="", + port=0, + sourceAddress="", + mcastInterface="", + mcastTtl=0, + ): if Ice.getType(self) == _M_Ice.UDPEndpointInfo: - raise RuntimeError('Ice.UDPEndpointInfo is an abstract class') - _M_Ice.IPEndpointInfo.__init__(self, underlying, timeout, compress, host, port, sourceAddress) + raise RuntimeError("Ice.UDPEndpointInfo is an abstract class") + _M_Ice.IPEndpointInfo.__init__( + self, underlying, timeout, compress, host, port, sourceAddress + ) self.mcastInterface = mcastInterface self.mcastTtl = mcastTtl @@ -206,18 +264,27 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_UDPEndpointInfo = IcePy.declareValue('::Ice::UDPEndpointInfo') - - _M_Ice._t_UDPEndpointInfo = IcePy.defineValue('::Ice::UDPEndpointInfo', UDPEndpointInfo, -1, (), False, False, _M_Ice._t_IPEndpointInfo, ( - ('mcastInterface', (), IcePy._t_string, False, 0), - ('mcastTtl', (), IcePy._t_int, False, 0) - )) + _M_Ice._t_UDPEndpointInfo = IcePy.declareValue("::Ice::UDPEndpointInfo") + + _M_Ice._t_UDPEndpointInfo = IcePy.defineValue( + "::Ice::UDPEndpointInfo", + UDPEndpointInfo, + -1, + (), + False, + False, + _M_Ice._t_IPEndpointInfo, + ( + ("mcastInterface", (), IcePy._t_string, False, 0), + ("mcastTtl", (), IcePy._t_int, False, 0), + ), + ) UDPEndpointInfo._ice_type = _M_Ice._t_UDPEndpointInfo _M_Ice.UDPEndpointInfo = UDPEndpointInfo del UDPEndpointInfo -if 'WSEndpointInfo' not in _M_Ice.__dict__: +if "WSEndpointInfo" not in _M_Ice.__dict__: _M_Ice.WSEndpointInfo = Ice.createTempClass() class WSEndpointInfo(_M_Ice.EndpointInfo): @@ -227,9 +294,9 @@ class WSEndpointInfo(_M_Ice.EndpointInfo): resource -- The URI configured with the endpoint. """ - def __init__(self, underlying=None, timeout=0, compress=False, resource=''): + def __init__(self, underlying=None, timeout=0, compress=False, resource=""): if Ice.getType(self) == _M_Ice.WSEndpointInfo: - raise RuntimeError('Ice.WSEndpointInfo is an abstract class') + raise RuntimeError("Ice.WSEndpointInfo is an abstract class") _M_Ice.EndpointInfo.__init__(self, underlying, timeout, compress) self.resource = resource @@ -238,16 +305,24 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_WSEndpointInfo = IcePy.declareValue('::Ice::WSEndpointInfo') - - _M_Ice._t_WSEndpointInfo = IcePy.defineValue('::Ice::WSEndpointInfo', WSEndpointInfo, -1, - (), False, False, _M_Ice._t_EndpointInfo, (('resource', (), IcePy._t_string, False, 0),)) + _M_Ice._t_WSEndpointInfo = IcePy.declareValue("::Ice::WSEndpointInfo") + + _M_Ice._t_WSEndpointInfo = IcePy.defineValue( + "::Ice::WSEndpointInfo", + WSEndpointInfo, + -1, + (), + False, + False, + _M_Ice._t_EndpointInfo, + (("resource", (), IcePy._t_string, False, 0),), + ) WSEndpointInfo._ice_type = _M_Ice._t_WSEndpointInfo _M_Ice.WSEndpointInfo = WSEndpointInfo del WSEndpointInfo -if 'OpaqueEndpointInfo' not in _M_Ice.__dict__: +if "OpaqueEndpointInfo" not in _M_Ice.__dict__: _M_Ice.OpaqueEndpointInfo = Ice.createTempClass() class OpaqueEndpointInfo(_M_Ice.EndpointInfo): @@ -258,9 +333,16 @@ class OpaqueEndpointInfo(_M_Ice.EndpointInfo): rawBytes -- The raw encoding of the opaque endpoint. """ - def __init__(self, underlying=None, timeout=0, compress=False, rawEncoding=Ice._struct_marker, rawBytes=None): + def __init__( + self, + underlying=None, + timeout=0, + compress=False, + rawEncoding=Ice._struct_marker, + rawBytes=None, + ): if Ice.getType(self) == _M_Ice.OpaqueEndpointInfo: - raise RuntimeError('Ice.OpaqueEndpointInfo is an abstract class') + raise RuntimeError("Ice.OpaqueEndpointInfo is an abstract class") _M_Ice.EndpointInfo.__init__(self, underlying, timeout, compress) if rawEncoding is Ice._struct_marker: self.rawEncoding = _M_Ice.EncodingVersion() @@ -273,12 +355,21 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_OpaqueEndpointInfo = IcePy.declareValue('::Ice::OpaqueEndpointInfo') - - _M_Ice._t_OpaqueEndpointInfo = IcePy.defineValue('::Ice::OpaqueEndpointInfo', OpaqueEndpointInfo, -1, (), False, False, _M_Ice._t_EndpointInfo, ( - ('rawEncoding', (), _M_Ice._t_EncodingVersion, False, 0), - ('rawBytes', (), _M_Ice._t_ByteSeq, False, 0) - )) + _M_Ice._t_OpaqueEndpointInfo = IcePy.declareValue("::Ice::OpaqueEndpointInfo") + + _M_Ice._t_OpaqueEndpointInfo = IcePy.defineValue( + "::Ice::OpaqueEndpointInfo", + OpaqueEndpointInfo, + -1, + (), + False, + False, + _M_Ice._t_EndpointInfo, + ( + ("rawEncoding", (), _M_Ice._t_EncodingVersion, False, 0), + ("rawBytes", (), _M_Ice._t_ByteSeq, False, 0), + ), + ) OpaqueEndpointInfo._ice_type = _M_Ice._t_OpaqueEndpointInfo _M_Ice.OpaqueEndpointInfo = OpaqueEndpointInfo diff --git a/python/python/Ice/FacetMap_local.py b/python/python/Ice/FacetMap_local.py index 579959d7b19..43e7a5e08ad 100644 --- a/python/python/Ice/FacetMap_local.py +++ b/python/python/Ice/FacetMap_local.py @@ -18,10 +18,12 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if '_t_FacetMap' not in _M_Ice.__dict__: - _M_Ice._t_FacetMap = IcePy.defineDictionary('::Ice::FacetMap', (), IcePy._t_string, IcePy._t_Value) +if "_t_FacetMap" not in _M_Ice.__dict__: + _M_Ice._t_FacetMap = IcePy.defineDictionary( + "::Ice::FacetMap", (), IcePy._t_string, IcePy._t_Value + ) # End of module Ice diff --git a/python/python/Ice/IceFuture.py b/python/python/Ice/IceFuture.py index 2246fd19fda..164bb661563 100644 --- a/python/python/Ice/IceFuture.py +++ b/python/python/Ice/IceFuture.py @@ -16,11 +16,13 @@ def __await__(self): def wrap_future(future, *, loop=None): - '''Wrap Ice.Future object into an asyncio.Future.''' + """Wrap Ice.Future object into an asyncio.Future.""" if isinstance(future, asyncio.Future): return future - assert isinstance(future, FutureBase), 'Ice.Future is expected, got {!r}'.format(future) + assert isinstance(future, FutureBase), "Ice.Future is expected, got {!r}".format( + future + ) def forwardCompletion(sourceFuture, targetFuture): if not targetFuture.done(): @@ -40,7 +42,13 @@ def forwardCompletion(sourceFuture, targetFuture): # even if the future is constructed with a loop which isn't the current thread's loop. forwardCompletion(future, asyncioFuture) else: - asyncioFuture.add_done_callback(lambda f: forwardCompletion(asyncioFuture, future)) - future.add_done_callback(lambda f: loop.call_soon_threadsafe(forwardCompletion, future, asyncioFuture)) + asyncioFuture.add_done_callback( + lambda f: forwardCompletion(asyncioFuture, future) + ) + future.add_done_callback( + lambda f: loop.call_soon_threadsafe( + forwardCompletion, future, asyncioFuture + ) + ) return asyncioFuture diff --git a/python/python/Ice/ImplicitContextF_local.py b/python/python/Ice/ImplicitContextF_local.py index 0c718f690a7..bd7a59a07e7 100644 --- a/python/python/Ice/ImplicitContextF_local.py +++ b/python/python/Ice/ImplicitContextF_local.py @@ -18,10 +18,10 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'ImplicitContext' not in _M_Ice.__dict__: - _M_Ice._t_ImplicitContext = IcePy.declareValue('::Ice::ImplicitContext') +if "ImplicitContext" not in _M_Ice.__dict__: + _M_Ice._t_ImplicitContext = IcePy.declareValue("::Ice::ImplicitContext") # End of module Ice diff --git a/python/python/Ice/ImplicitContext_local.py b/python/python/Ice/ImplicitContext_local.py index 518e0f0e2e1..fb3c4f95c78 100644 --- a/python/python/Ice/ImplicitContext_local.py +++ b/python/python/Ice/ImplicitContext_local.py @@ -20,38 +20,38 @@ import Ice.Current_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'ImplicitContext' not in _M_Ice.__dict__: +if "ImplicitContext" not in _M_Ice.__dict__: _M_Ice.ImplicitContext = Ice.createTempClass() class ImplicitContext(object): """ - An interface to associate implict contexts with communicators. When you make a remote invocation without an - explicit context parameter, Ice uses the per-proxy context (if any) combined with the ImplicitContext - associated with the communicator. - Ice provides several implementations of ImplicitContext. The implementation used depends on the value - of the Ice.ImplicitContext property. - - None (default) - No implicit context at all. - PerThread - The implementation maintains a context per thread. - Shared - The implementation maintains a single context shared by all threads. - - ImplicitContext also provides a number of operations to create, update or retrieve an entry in the - underlying context without first retrieving a copy of the entire context. These operations correspond to a subset - of the java.util.Map methods, with java.lang.Object replaced by string and - null replaced by the empty-string. + An interface to associate implict contexts with communicators. When you make a remote invocation without an + explicit context parameter, Ice uses the per-proxy context (if any) combined with the ImplicitContext + associated with the communicator. + Ice provides several implementations of ImplicitContext. The implementation used depends on the value + of the Ice.ImplicitContext property. + + None (default) + No implicit context at all. + PerThread + The implementation maintains a context per thread. + Shared + The implementation maintains a single context shared by all threads. + + ImplicitContext also provides a number of operations to create, update or retrieve an entry in the + underlying context without first retrieving a copy of the entire context. These operations correspond to a subset + of the java.util.Map methods, with java.lang.Object replaced by string and + null replaced by the empty-string. """ def __init__(self): if Ice.getType(self) == _M_Ice.ImplicitContext: - raise RuntimeError('Ice.ImplicitContext is an abstract class') + raise RuntimeError("Ice.ImplicitContext is an abstract class") def getContext(self): """ @@ -113,7 +113,8 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ImplicitContext = IcePy.defineValue( - '::Ice::ImplicitContext', ImplicitContext, -1, (), False, True, None, ()) + "::Ice::ImplicitContext", ImplicitContext, -1, (), False, True, None, () + ) ImplicitContext._ice_type = _M_Ice._t_ImplicitContext _M_Ice.ImplicitContext = ImplicitContext diff --git a/python/python/Ice/InstrumentationF_local.py b/python/python/Ice/InstrumentationF_local.py index cbef7d8b746..cd16235d8a3 100644 --- a/python/python/Ice/InstrumentationF_local.py +++ b/python/python/Ice/InstrumentationF_local.py @@ -18,21 +18,25 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" # Start of module Ice.Instrumentation -_M_Ice.Instrumentation = Ice.openModule('Ice.Instrumentation') -__name__ = 'Ice.Instrumentation' +_M_Ice.Instrumentation = Ice.openModule("Ice.Instrumentation") +__name__ = "Ice.Instrumentation" -if 'Observer' not in _M_Ice.Instrumentation.__dict__: - _M_Ice.Instrumentation._t_Observer = IcePy.declareValue('::Ice::Instrumentation::Observer') +if "Observer" not in _M_Ice.Instrumentation.__dict__: + _M_Ice.Instrumentation._t_Observer = IcePy.declareValue( + "::Ice::Instrumentation::Observer" + ) -if 'CommunicatorObserver' not in _M_Ice.Instrumentation.__dict__: - _M_Ice.Instrumentation._t_CommunicatorObserver = IcePy.declareValue('::Ice::Instrumentation::CommunicatorObserver') +if "CommunicatorObserver" not in _M_Ice.Instrumentation.__dict__: + _M_Ice.Instrumentation._t_CommunicatorObserver = IcePy.declareValue( + "::Ice::Instrumentation::CommunicatorObserver" + ) # End of module Ice.Instrumentation -__name__ = 'Ice' +__name__ = "Ice" # End of module Ice diff --git a/python/python/Ice/Instrumentation_local.py b/python/python/Ice/Instrumentation_local.py index d3a2a9e9efc..ab92c6988aa 100644 --- a/python/python/Ice/Instrumentation_local.py +++ b/python/python/Ice/Instrumentation_local.py @@ -21,42 +21,42 @@ import Ice.Current_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" # Start of module Ice.Instrumentation -_M_Ice.Instrumentation = Ice.openModule('Ice.Instrumentation') -__name__ = 'Ice.Instrumentation' +_M_Ice.Instrumentation = Ice.openModule("Ice.Instrumentation") +__name__ = "Ice.Instrumentation" _M_Ice.Instrumentation.__doc__ = """ The Instrumentation local interfaces enable observing a number of Ice core internal components (threads, connections, etc). """ -if 'Observer' not in _M_Ice.Instrumentation.__dict__: +if "Observer" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.Observer = Ice.createTempClass() class Observer(object): """ - The object observer interface used by instrumented objects to notify the observer of their existence. + The object observer interface used by instrumented objects to notify the observer of their existence. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.Observer: - raise RuntimeError('Ice.Instrumentation.Observer is an abstract class') + raise RuntimeError("Ice.Instrumentation.Observer is an abstract class") def attach(self): """ - This method is called when the instrumented object is created or when the observer is attached to an existing - object. + This method is called when the instrumented object is created or when the observer is attached to an existing + object. """ raise NotImplementedError("method 'attach' not implemented") def detach(self): """ - This method is called when the instrumented object is destroyed and as a result the observer detached from the - object. + This method is called when the instrumented object is destroyed and as a result the observer detached from the + object. """ raise NotImplementedError("method 'detach' not implemented") @@ -74,13 +74,14 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_Observer = IcePy.defineValue( - '::Ice::Instrumentation::Observer', Observer, -1, (), False, True, None, ()) + "::Ice::Instrumentation::Observer", Observer, -1, (), False, True, None, () + ) Observer._ice_type = _M_Ice.Instrumentation._t_Observer _M_Ice.Instrumentation.Observer = Observer del Observer -if 'ThreadState' not in _M_Ice.Instrumentation.__dict__: +if "ThreadState" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.ThreadState = Ice.createTempClass() class ThreadState(Ice.EnumBase): @@ -102,33 +103,41 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) ThreadState.ThreadStateIdle = ThreadState("ThreadStateIdle", 0) ThreadState.ThreadStateInUseForIO = ThreadState("ThreadStateInUseForIO", 1) ThreadState.ThreadStateInUseForUser = ThreadState("ThreadStateInUseForUser", 2) ThreadState.ThreadStateInUseForOther = ThreadState("ThreadStateInUseForOther", 3) - ThreadState._enumerators = {0: ThreadState.ThreadStateIdle, 1: ThreadState.ThreadStateInUseForIO, - 2: ThreadState.ThreadStateInUseForUser, 3: ThreadState.ThreadStateInUseForOther} + ThreadState._enumerators = { + 0: ThreadState.ThreadStateIdle, + 1: ThreadState.ThreadStateInUseForIO, + 2: ThreadState.ThreadStateInUseForUser, + 3: ThreadState.ThreadStateInUseForOther, + } _M_Ice.Instrumentation._t_ThreadState = IcePy.defineEnum( - '::Ice::Instrumentation::ThreadState', ThreadState, (), ThreadState._enumerators) + "::Ice::Instrumentation::ThreadState", ThreadState, (), ThreadState._enumerators + ) _M_Ice.Instrumentation.ThreadState = ThreadState del ThreadState -if 'ThreadObserver' not in _M_Ice.Instrumentation.__dict__: +if "ThreadObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.ThreadObserver = Ice.createTempClass() class ThreadObserver(_M_Ice.Instrumentation.Observer): """ - The thread observer interface to instrument Ice threads. This can be threads from the Ice thread pool or utility - threads used by the Ice core. + The thread observer interface to instrument Ice threads. This can be threads from the Ice thread pool or utility + threads used by the Ice core. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.ThreadObserver: - raise RuntimeError('Ice.Instrumentation.ThreadObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.ThreadObserver is an abstract class" + ) def stateChanged(self, oldState, newState): """ @@ -145,13 +154,21 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_ThreadObserver = IcePy.defineValue( - '::Ice::Instrumentation::ThreadObserver', ThreadObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::ThreadObserver", + ThreadObserver, + -1, + (), + False, + True, + None, + (), + ) ThreadObserver._ice_type = _M_Ice.Instrumentation._t_ThreadObserver _M_Ice.Instrumentation.ThreadObserver = ThreadObserver del ThreadObserver -if 'ConnectionState' not in _M_Ice.Instrumentation.__dict__: +if "ConnectionState" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.ConnectionState = Ice.createTempClass() class ConnectionState(Ice.EnumBase): @@ -173,33 +190,51 @@ def valueOf(self, _n): if _n in self._enumerators: return self._enumerators[_n] return None + valueOf = classmethod(valueOf) - ConnectionState.ConnectionStateValidating = ConnectionState("ConnectionStateValidating", 0) - ConnectionState.ConnectionStateHolding = ConnectionState("ConnectionStateHolding", 1) + ConnectionState.ConnectionStateValidating = ConnectionState( + "ConnectionStateValidating", 0 + ) + ConnectionState.ConnectionStateHolding = ConnectionState( + "ConnectionStateHolding", 1 + ) ConnectionState.ConnectionStateActive = ConnectionState("ConnectionStateActive", 2) - ConnectionState.ConnectionStateClosing = ConnectionState("ConnectionStateClosing", 3) + ConnectionState.ConnectionStateClosing = ConnectionState( + "ConnectionStateClosing", 3 + ) ConnectionState.ConnectionStateClosed = ConnectionState("ConnectionStateClosed", 4) - ConnectionState._enumerators = {0: ConnectionState.ConnectionStateValidating, 1: ConnectionState.ConnectionStateHolding, - 2: ConnectionState.ConnectionStateActive, 3: ConnectionState.ConnectionStateClosing, 4: ConnectionState.ConnectionStateClosed} + ConnectionState._enumerators = { + 0: ConnectionState.ConnectionStateValidating, + 1: ConnectionState.ConnectionStateHolding, + 2: ConnectionState.ConnectionStateActive, + 3: ConnectionState.ConnectionStateClosing, + 4: ConnectionState.ConnectionStateClosed, + } _M_Ice.Instrumentation._t_ConnectionState = IcePy.defineEnum( - '::Ice::Instrumentation::ConnectionState', ConnectionState, (), ConnectionState._enumerators) + "::Ice::Instrumentation::ConnectionState", + ConnectionState, + (), + ConnectionState._enumerators, + ) _M_Ice.Instrumentation.ConnectionState = ConnectionState del ConnectionState -if 'ConnectionObserver' not in _M_Ice.Instrumentation.__dict__: +if "ConnectionObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.ConnectionObserver = Ice.createTempClass() class ConnectionObserver(_M_Ice.Instrumentation.Observer): """ - The connection observer interface to instrument Ice connections. + The connection observer interface to instrument Ice connections. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.ConnectionObserver: - raise RuntimeError('Ice.Instrumentation.ConnectionObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.ConnectionObserver is an abstract class" + ) def sentBytes(self, num): """ @@ -223,27 +258,37 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_ConnectionObserver = IcePy.defineValue( - '::Ice::Instrumentation::ConnectionObserver', ConnectionObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::ConnectionObserver", + ConnectionObserver, + -1, + (), + False, + True, + None, + (), + ) ConnectionObserver._ice_type = _M_Ice.Instrumentation._t_ConnectionObserver _M_Ice.Instrumentation.ConnectionObserver = ConnectionObserver del ConnectionObserver -if 'DispatchObserver' not in _M_Ice.Instrumentation.__dict__: +if "DispatchObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.DispatchObserver = Ice.createTempClass() class DispatchObserver(_M_Ice.Instrumentation.Observer): """ - The dispatch observer to instrument servant dispatch. + The dispatch observer to instrument servant dispatch. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.DispatchObserver: - raise RuntimeError('Ice.Instrumentation.DispatchObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.DispatchObserver is an abstract class" + ) def userException(self): """ - Notification of a user exception. + Notification of a user exception. """ raise NotImplementedError("method 'userException' not implemented") @@ -261,23 +306,33 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_DispatchObserver = IcePy.defineValue( - '::Ice::Instrumentation::DispatchObserver', DispatchObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::DispatchObserver", + DispatchObserver, + -1, + (), + False, + True, + None, + (), + ) DispatchObserver._ice_type = _M_Ice.Instrumentation._t_DispatchObserver _M_Ice.Instrumentation.DispatchObserver = DispatchObserver del DispatchObserver -if 'ChildInvocationObserver' not in _M_Ice.Instrumentation.__dict__: +if "ChildInvocationObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.ChildInvocationObserver = Ice.createTempClass() class ChildInvocationObserver(_M_Ice.Instrumentation.Observer): """ - The child invocation observer to instrument remote or collocated invocations. + The child invocation observer to instrument remote or collocated invocations. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.ChildInvocationObserver: - raise RuntimeError('Ice.Instrumentation.ChildInvocationObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.ChildInvocationObserver is an abstract class" + ) def reply(self, size): """ @@ -288,28 +343,42 @@ def reply(self, size): raise NotImplementedError("method 'reply' not implemented") def __str__(self): - return IcePy.stringify(self, _M_Ice.Instrumentation._t_ChildInvocationObserver) + return IcePy.stringify( + self, _M_Ice.Instrumentation._t_ChildInvocationObserver + ) __repr__ = __str__ _M_Ice.Instrumentation._t_ChildInvocationObserver = IcePy.defineValue( - '::Ice::Instrumentation::ChildInvocationObserver', ChildInvocationObserver, -1, (), False, True, None, ()) - ChildInvocationObserver._ice_type = _M_Ice.Instrumentation._t_ChildInvocationObserver + "::Ice::Instrumentation::ChildInvocationObserver", + ChildInvocationObserver, + -1, + (), + False, + True, + None, + (), + ) + ChildInvocationObserver._ice_type = ( + _M_Ice.Instrumentation._t_ChildInvocationObserver + ) _M_Ice.Instrumentation.ChildInvocationObserver = ChildInvocationObserver del ChildInvocationObserver -if 'RemoteObserver' not in _M_Ice.Instrumentation.__dict__: +if "RemoteObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.RemoteObserver = Ice.createTempClass() class RemoteObserver(_M_Ice.Instrumentation.ChildInvocationObserver): """ - The remote observer to instrument invocations that are sent over the wire. + The remote observer to instrument invocations that are sent over the wire. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.RemoteObserver: - raise RuntimeError('Ice.Instrumentation.RemoteObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.RemoteObserver is an abstract class" + ) def __str__(self): return IcePy.stringify(self, _M_Ice.Instrumentation._t_RemoteObserver) @@ -317,23 +386,33 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_RemoteObserver = IcePy.defineValue( - '::Ice::Instrumentation::RemoteObserver', RemoteObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::RemoteObserver", + RemoteObserver, + -1, + (), + False, + True, + None, + (), + ) RemoteObserver._ice_type = _M_Ice.Instrumentation._t_RemoteObserver _M_Ice.Instrumentation.RemoteObserver = RemoteObserver del RemoteObserver -if 'CollocatedObserver' not in _M_Ice.Instrumentation.__dict__: +if "CollocatedObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.CollocatedObserver = Ice.createTempClass() class CollocatedObserver(_M_Ice.Instrumentation.ChildInvocationObserver): """ - The collocated observer to instrument invocations that are collocated. + The collocated observer to instrument invocations that are collocated. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.CollocatedObserver: - raise RuntimeError('Ice.Instrumentation.CollocatedObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.CollocatedObserver is an abstract class" + ) def __str__(self): return IcePy.stringify(self, _M_Ice.Instrumentation._t_CollocatedObserver) @@ -341,34 +420,44 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_CollocatedObserver = IcePy.defineValue( - '::Ice::Instrumentation::CollocatedObserver', CollocatedObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::CollocatedObserver", + CollocatedObserver, + -1, + (), + False, + True, + None, + (), + ) CollocatedObserver._ice_type = _M_Ice.Instrumentation._t_CollocatedObserver _M_Ice.Instrumentation.CollocatedObserver = CollocatedObserver del CollocatedObserver -if 'InvocationObserver' not in _M_Ice.Instrumentation.__dict__: +if "InvocationObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.InvocationObserver = Ice.createTempClass() class InvocationObserver(_M_Ice.Instrumentation.Observer): """ - The invocation observer to instrument invocations on proxies. A proxy invocation can either result in a collocated - or remote invocation. If it results in a remote invocation, a sub-observer is requested for the remote invocation. + The invocation observer to instrument invocations on proxies. A proxy invocation can either result in a collocated + or remote invocation. If it results in a remote invocation, a sub-observer is requested for the remote invocation. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.InvocationObserver: - raise RuntimeError('Ice.Instrumentation.InvocationObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.InvocationObserver is an abstract class" + ) def retried(self): """ - Notification of the invocation being retried. + Notification of the invocation being retried. """ raise NotImplementedError("method 'retried' not implemented") def userException(self): """ - Notification of a user exception. + Notification of a user exception. """ raise NotImplementedError("method 'userException' not implemented") @@ -401,45 +490,57 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_InvocationObserver = IcePy.defineValue( - '::Ice::Instrumentation::InvocationObserver', InvocationObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::InvocationObserver", + InvocationObserver, + -1, + (), + False, + True, + None, + (), + ) InvocationObserver._ice_type = _M_Ice.Instrumentation._t_InvocationObserver _M_Ice.Instrumentation.InvocationObserver = InvocationObserver del InvocationObserver -if 'ObserverUpdater' not in _M_Ice.Instrumentation.__dict__: +if "ObserverUpdater" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.ObserverUpdater = Ice.createTempClass() class ObserverUpdater(object): """ - The observer updater interface. This interface is implemented by the Ice run-time and an instance of this interface - is provided by the Ice communicator on initialization to the CommunicatorObserver object set with the - communicator initialization data. The Ice communicator calls CommunicatorObserver#setObserverUpdater to - provide the observer updater. - This interface can be used by add-ins implementing the CommunicatorObserver interface to update the - observers of connections and threads. + The observer updater interface. This interface is implemented by the Ice run-time and an instance of this interface + is provided by the Ice communicator on initialization to the CommunicatorObserver object set with the + communicator initialization data. The Ice communicator calls CommunicatorObserver#setObserverUpdater to + provide the observer updater. + This interface can be used by add-ins implementing the CommunicatorObserver interface to update the + observers of connections and threads. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.ObserverUpdater: - raise RuntimeError('Ice.Instrumentation.ObserverUpdater is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.ObserverUpdater is an abstract class" + ) def updateConnectionObservers(self): """ - Update connection observers associated with each of the Ice connection from the communicator and its object - adapters. - When called, this method goes through all the connections and for each connection - CommunicatorObserver#getConnectionObserver is called. The implementation of getConnectionObserver has - the possibility to return an updated observer if necessary. + Update connection observers associated with each of the Ice connection from the communicator and its object + adapters. + When called, this method goes through all the connections and for each connection + CommunicatorObserver#getConnectionObserver is called. The implementation of getConnectionObserver has + the possibility to return an updated observer if necessary. """ - raise NotImplementedError("method 'updateConnectionObservers' not implemented") + raise NotImplementedError( + "method 'updateConnectionObservers' not implemented" + ) def updateThreadObservers(self): """ - Update thread observers associated with each of the Ice thread from the communicator and its object adapters. - When called, this method goes through all the threads and for each thread - CommunicatorObserver#getThreadObserver is called. The implementation of getThreadObserver has the - possibility to return an updated observer if necessary. + Update thread observers associated with each of the Ice thread from the communicator and its object adapters. + When called, this method goes through all the threads and for each thread + CommunicatorObserver#getThreadObserver is called. The implementation of getThreadObserver has the + possibility to return an updated observer if necessary. """ raise NotImplementedError("method 'updateThreadObservers' not implemented") @@ -449,26 +550,36 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_ObserverUpdater = IcePy.defineValue( - '::Ice::Instrumentation::ObserverUpdater', ObserverUpdater, -1, (), False, True, None, ()) + "::Ice::Instrumentation::ObserverUpdater", + ObserverUpdater, + -1, + (), + False, + True, + None, + (), + ) ObserverUpdater._ice_type = _M_Ice.Instrumentation._t_ObserverUpdater _M_Ice.Instrumentation.ObserverUpdater = ObserverUpdater del ObserverUpdater -if 'CommunicatorObserver' not in _M_Ice.Instrumentation.__dict__: +if "CommunicatorObserver" not in _M_Ice.Instrumentation.__dict__: _M_Ice.Instrumentation.CommunicatorObserver = Ice.createTempClass() class CommunicatorObserver(object): """ - The communicator observer interface used by the Ice run-time to obtain and update observers for its observable - objects. This interface should be implemented by add-ins that wish to observe Ice objects in order to collect - statistics. An instance of this interface can be provided to the Ice run-time through the Ice communicator - initialization data. + The communicator observer interface used by the Ice run-time to obtain and update observers for its observable + objects. This interface should be implemented by add-ins that wish to observe Ice objects in order to collect + statistics. An instance of this interface can be provided to the Ice run-time through the Ice communicator + initialization data. """ def __init__(self): if Ice.getType(self) == _M_Ice.Instrumentation.CommunicatorObserver: - raise RuntimeError('Ice.Instrumentation.CommunicatorObserver is an abstract class') + raise RuntimeError( + "Ice.Instrumentation.CommunicatorObserver is an abstract class" + ) def getConnectionEstablishmentObserver(self, endpt, connector): """ @@ -479,7 +590,9 @@ def getConnectionEstablishmentObserver(self, endpt, connector): connector -- The description of the connector. For IP transports, this is typically the IP address to connect to. Returns: The observer to instrument the connection establishment. """ - raise NotImplementedError("method 'getConnectionEstablishmentObserver' not implemented") + raise NotImplementedError( + "method 'getConnectionEstablishmentObserver' not implemented" + ) def getEndpointLookupObserver(self, endpt): """ @@ -490,7 +603,9 @@ def getEndpointLookupObserver(self, endpt): endpt -- The endpoint. Returns: The observer to instrument the endpoint lookup. """ - raise NotImplementedError("method 'getEndpointLookupObserver' not implemented") + raise NotImplementedError( + "method 'getEndpointLookupObserver' not implemented" + ) def getConnectionObserver(self, c, e, s, o): """ @@ -558,7 +673,15 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_CommunicatorObserver = IcePy.defineValue( - '::Ice::Instrumentation::CommunicatorObserver', CommunicatorObserver, -1, (), False, True, None, ()) + "::Ice::Instrumentation::CommunicatorObserver", + CommunicatorObserver, + -1, + (), + False, + True, + None, + (), + ) CommunicatorObserver._ice_type = _M_Ice.Instrumentation._t_CommunicatorObserver _M_Ice.Instrumentation.CommunicatorObserver = CommunicatorObserver @@ -566,6 +689,6 @@ def __str__(self): # End of module Ice.Instrumentation -__name__ = 'Ice' +__name__ = "Ice" # End of module Ice diff --git a/python/python/Ice/LocalException_local.py b/python/python/Ice/LocalException_local.py index 388589b7442..51bc6ed0a11 100644 --- a/python/python/Ice/LocalException_local.py +++ b/python/python/Ice/LocalException_local.py @@ -21,12 +21,12 @@ import Ice.BuiltinSequences_ice # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'InitializationException' not in _M_Ice.__dict__: +if "InitializationException" not in _M_Ice.__dict__: _M_Ice.InitializationException = Ice.createTempClass() class InitializationException(Ice.LocalException): @@ -36,7 +36,7 @@ class InitializationException(Ice.LocalException): reason -- The reason for the failure. """ - def __init__(self, reason=''): + def __init__(self, reason=""): self.reason = reason def __str__(self): @@ -44,16 +44,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::InitializationException' + _ice_id = "::Ice::InitializationException" _M_Ice._t_InitializationException = IcePy.defineException( - '::Ice::InitializationException', InitializationException, (), False, None, (('reason', (), IcePy._t_string, False, 0),)) + "::Ice::InitializationException", + InitializationException, + (), + False, + None, + (("reason", (), IcePy._t_string, False, 0),), + ) InitializationException._ice_type = _M_Ice._t_InitializationException _M_Ice.InitializationException = InitializationException del InitializationException -if 'PluginInitializationException' not in _M_Ice.__dict__: +if "PluginInitializationException" not in _M_Ice.__dict__: _M_Ice.PluginInitializationException = Ice.createTempClass() class PluginInitializationException(Ice.LocalException): @@ -63,7 +69,7 @@ class PluginInitializationException(Ice.LocalException): reason -- The reason for the failure. """ - def __init__(self, reason=''): + def __init__(self, reason=""): self.reason = reason def __str__(self): @@ -71,21 +77,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::PluginInitializationException' + _ice_id = "::Ice::PluginInitializationException" _M_Ice._t_PluginInitializationException = IcePy.defineException( - '::Ice::PluginInitializationException', PluginInitializationException, (), False, None, (('reason', (), IcePy._t_string, False, 0),)) + "::Ice::PluginInitializationException", + PluginInitializationException, + (), + False, + None, + (("reason", (), IcePy._t_string, False, 0),), + ) PluginInitializationException._ice_type = _M_Ice._t_PluginInitializationException _M_Ice.PluginInitializationException = PluginInitializationException del PluginInitializationException -if 'CollocationOptimizationException' not in _M_Ice.__dict__: +if "CollocationOptimizationException" not in _M_Ice.__dict__: _M_Ice.CollocationOptimizationException = Ice.createTempClass() class CollocationOptimizationException(Ice.LocalException): """ - This exception is raised if a feature is requested that is not supported with collocation optimization. + This exception is raised if a feature is requested that is not supported with collocation optimization. """ def __init__(self): @@ -96,16 +108,24 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CollocationOptimizationException' + _ice_id = "::Ice::CollocationOptimizationException" _M_Ice._t_CollocationOptimizationException = IcePy.defineException( - '::Ice::CollocationOptimizationException', CollocationOptimizationException, (), False, None, ()) - CollocationOptimizationException._ice_type = _M_Ice._t_CollocationOptimizationException + "::Ice::CollocationOptimizationException", + CollocationOptimizationException, + (), + False, + None, + (), + ) + CollocationOptimizationException._ice_type = ( + _M_Ice._t_CollocationOptimizationException + ) _M_Ice.CollocationOptimizationException = CollocationOptimizationException del CollocationOptimizationException -if 'AlreadyRegisteredException' not in _M_Ice.__dict__: +if "AlreadyRegisteredException" not in _M_Ice.__dict__: _M_Ice.AlreadyRegisteredException = Ice.createTempClass() class AlreadyRegisteredException(Ice.LocalException): @@ -119,7 +139,7 @@ class AlreadyRegisteredException(Ice.LocalException): id -- The ID (or name) of the object that is registered already. """ - def __init__(self, kindOfObject='', id=''): + def __init__(self, kindOfObject="", id=""): self.kindOfObject = kindOfObject self.id = id @@ -128,18 +148,25 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::AlreadyRegisteredException' + _ice_id = "::Ice::AlreadyRegisteredException" - _M_Ice._t_AlreadyRegisteredException = IcePy.defineException('::Ice::AlreadyRegisteredException', AlreadyRegisteredException, (), False, None, ( - ('kindOfObject', (), IcePy._t_string, False, 0), - ('id', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_AlreadyRegisteredException = IcePy.defineException( + "::Ice::AlreadyRegisteredException", + AlreadyRegisteredException, + (), + False, + None, + ( + ("kindOfObject", (), IcePy._t_string, False, 0), + ("id", (), IcePy._t_string, False, 0), + ), + ) AlreadyRegisteredException._ice_type = _M_Ice._t_AlreadyRegisteredException _M_Ice.AlreadyRegisteredException = AlreadyRegisteredException del AlreadyRegisteredException -if 'NotRegisteredException' not in _M_Ice.__dict__: +if "NotRegisteredException" not in _M_Ice.__dict__: _M_Ice.NotRegisteredException = Ice.createTempClass() class NotRegisteredException(Ice.LocalException): @@ -155,7 +182,7 @@ class NotRegisteredException(Ice.LocalException): id -- The ID (or name) of the object that could not be removed. """ - def __init__(self, kindOfObject='', id=''): + def __init__(self, kindOfObject="", id=""): self.kindOfObject = kindOfObject self.id = id @@ -164,18 +191,25 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::NotRegisteredException' + _ice_id = "::Ice::NotRegisteredException" - _M_Ice._t_NotRegisteredException = IcePy.defineException('::Ice::NotRegisteredException', NotRegisteredException, (), False, None, ( - ('kindOfObject', (), IcePy._t_string, False, 0), - ('id', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_NotRegisteredException = IcePy.defineException( + "::Ice::NotRegisteredException", + NotRegisteredException, + (), + False, + None, + ( + ("kindOfObject", (), IcePy._t_string, False, 0), + ("id", (), IcePy._t_string, False, 0), + ), + ) NotRegisteredException._ice_type = _M_Ice._t_NotRegisteredException _M_Ice.NotRegisteredException = NotRegisteredException del NotRegisteredException -if 'TwowayOnlyException' not in _M_Ice.__dict__: +if "TwowayOnlyException" not in _M_Ice.__dict__: _M_Ice.TwowayOnlyException = Ice.createTempClass() class TwowayOnlyException(Ice.LocalException): @@ -187,7 +221,7 @@ class TwowayOnlyException(Ice.LocalException): operation -- The name of the operation that was invoked. """ - def __init__(self, operation=''): + def __init__(self, operation=""): self.operation = operation def __str__(self): @@ -195,24 +229,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::TwowayOnlyException' + _ice_id = "::Ice::TwowayOnlyException" _M_Ice._t_TwowayOnlyException = IcePy.defineException( - '::Ice::TwowayOnlyException', TwowayOnlyException, (), False, None, (('operation', (), IcePy._t_string, False, 0),)) + "::Ice::TwowayOnlyException", + TwowayOnlyException, + (), + False, + None, + (("operation", (), IcePy._t_string, False, 0),), + ) TwowayOnlyException._ice_type = _M_Ice._t_TwowayOnlyException _M_Ice.TwowayOnlyException = TwowayOnlyException del TwowayOnlyException -if 'CloneNotImplementedException' not in _M_Ice.__dict__: +if "CloneNotImplementedException" not in _M_Ice.__dict__: _M_Ice.CloneNotImplementedException = Ice.createTempClass() class CloneNotImplementedException(Ice.LocalException): """ - An attempt was made to clone a class that does not support cloning. This exception is raised if - ice_clone is called on a class that is derived from an abstract Slice class (that is, a class - containing operations), and the derived class does not provide an implementation of the ice_clone - operation (C++ only). + An attempt was made to clone a class that does not support cloning. This exception is raised if + ice_clone is called on a class that is derived from an abstract Slice class (that is, a class + containing operations), and the derived class does not provide an implementation of the ice_clone + operation (C++ only). """ def __init__(self): @@ -223,16 +263,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CloneNotImplementedException' + _ice_id = "::Ice::CloneNotImplementedException" _M_Ice._t_CloneNotImplementedException = IcePy.defineException( - '::Ice::CloneNotImplementedException', CloneNotImplementedException, (), False, None, ()) + "::Ice::CloneNotImplementedException", + CloneNotImplementedException, + (), + False, + None, + (), + ) CloneNotImplementedException._ice_type = _M_Ice._t_CloneNotImplementedException _M_Ice.CloneNotImplementedException = CloneNotImplementedException del CloneNotImplementedException -if 'UnknownException' not in _M_Ice.__dict__: +if "UnknownException" not in _M_Ice.__dict__: _M_Ice.UnknownException = Ice.createTempClass() class UnknownException(Ice.LocalException): @@ -244,7 +290,7 @@ class UnknownException(Ice.LocalException): unknown -- This field is set to the textual representation of the unknown exception if available. """ - def __init__(self, unknown=''): + def __init__(self, unknown=""): self.unknown = unknown def __str__(self): @@ -252,28 +298,34 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnknownException' + _ice_id = "::Ice::UnknownException" _M_Ice._t_UnknownException = IcePy.defineException( - '::Ice::UnknownException', UnknownException, (), False, None, (('unknown', (), IcePy._t_string, False, 0),)) + "::Ice::UnknownException", + UnknownException, + (), + False, + None, + (("unknown", (), IcePy._t_string, False, 0),), + ) UnknownException._ice_type = _M_Ice._t_UnknownException _M_Ice.UnknownException = UnknownException del UnknownException -if 'UnknownLocalException' not in _M_Ice.__dict__: +if "UnknownLocalException" not in _M_Ice.__dict__: _M_Ice.UnknownLocalException = Ice.createTempClass() class UnknownLocalException(_M_Ice.UnknownException): """ - This exception is raised if an operation call on a server raises a local exception. Because local exceptions are - not transmitted by the Ice protocol, the client receives all local exceptions raised by the server as - UnknownLocalException. The only exception to this rule are all exceptions derived from - RequestFailedException, which are transmitted by the Ice protocol even though they are declared - local. + This exception is raised if an operation call on a server raises a local exception. Because local exceptions are + not transmitted by the Ice protocol, the client receives all local exceptions raised by the server as + UnknownLocalException. The only exception to this rule are all exceptions derived from + RequestFailedException, which are transmitted by the Ice protocol even though they are declared + local. """ - def __init__(self, unknown=''): + def __init__(self, unknown=""): _M_Ice.UnknownException.__init__(self, unknown) def __str__(self): @@ -281,28 +333,34 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnknownLocalException' + _ice_id = "::Ice::UnknownLocalException" _M_Ice._t_UnknownLocalException = IcePy.defineException( - '::Ice::UnknownLocalException', UnknownLocalException, (), False, _M_Ice._t_UnknownException, ()) + "::Ice::UnknownLocalException", + UnknownLocalException, + (), + False, + _M_Ice._t_UnknownException, + (), + ) UnknownLocalException._ice_type = _M_Ice._t_UnknownLocalException _M_Ice.UnknownLocalException = UnknownLocalException del UnknownLocalException -if 'UnknownUserException' not in _M_Ice.__dict__: +if "UnknownUserException" not in _M_Ice.__dict__: _M_Ice.UnknownUserException = Ice.createTempClass() class UnknownUserException(_M_Ice.UnknownException): """ - An operation raised an incorrect user exception. This exception is raised if an operation raises a user exception - that is not declared in the exception's throws clause. Such undeclared exceptions are not transmitted - from the server to the client by the Ice protocol, but instead the client just gets an UnknownUserException. - This is necessary in order to not violate the contract established by an operation's signature: Only local - exceptions and user exceptions declared in the throws clause can be raised. + An operation raised an incorrect user exception. This exception is raised if an operation raises a user exception + that is not declared in the exception's throws clause. Such undeclared exceptions are not transmitted + from the server to the client by the Ice protocol, but instead the client just gets an UnknownUserException. + This is necessary in order to not violate the contract established by an operation's signature: Only local + exceptions and user exceptions declared in the throws clause can be raised. """ - def __init__(self, unknown=''): + def __init__(self, unknown=""): _M_Ice.UnknownException.__init__(self, unknown) def __str__(self): @@ -310,21 +368,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnknownUserException' + _ice_id = "::Ice::UnknownUserException" _M_Ice._t_UnknownUserException = IcePy.defineException( - '::Ice::UnknownUserException', UnknownUserException, (), False, _M_Ice._t_UnknownException, ()) + "::Ice::UnknownUserException", + UnknownUserException, + (), + False, + _M_Ice._t_UnknownException, + (), + ) UnknownUserException._ice_type = _M_Ice._t_UnknownUserException _M_Ice.UnknownUserException = UnknownUserException del UnknownUserException -if 'VersionMismatchException' not in _M_Ice.__dict__: +if "VersionMismatchException" not in _M_Ice.__dict__: _M_Ice.VersionMismatchException = Ice.createTempClass() class VersionMismatchException(Ice.LocalException): """ - This exception is raised if the Ice library version does not match the version in the Ice header files. + This exception is raised if the Ice library version does not match the version in the Ice header files. """ def __init__(self): @@ -335,21 +399,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::VersionMismatchException' + _ice_id = "::Ice::VersionMismatchException" _M_Ice._t_VersionMismatchException = IcePy.defineException( - '::Ice::VersionMismatchException', VersionMismatchException, (), False, None, ()) + "::Ice::VersionMismatchException", VersionMismatchException, (), False, None, () + ) VersionMismatchException._ice_type = _M_Ice._t_VersionMismatchException _M_Ice.VersionMismatchException = VersionMismatchException del VersionMismatchException -if 'CommunicatorDestroyedException' not in _M_Ice.__dict__: +if "CommunicatorDestroyedException" not in _M_Ice.__dict__: _M_Ice.CommunicatorDestroyedException = Ice.createTempClass() class CommunicatorDestroyedException(Ice.LocalException): """ - This exception is raised if the Communicator has been destroyed. + This exception is raised if the Communicator has been destroyed. """ def __init__(self): @@ -360,16 +425,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CommunicatorDestroyedException' + _ice_id = "::Ice::CommunicatorDestroyedException" _M_Ice._t_CommunicatorDestroyedException = IcePy.defineException( - '::Ice::CommunicatorDestroyedException', CommunicatorDestroyedException, (), False, None, ()) + "::Ice::CommunicatorDestroyedException", + CommunicatorDestroyedException, + (), + False, + None, + (), + ) CommunicatorDestroyedException._ice_type = _M_Ice._t_CommunicatorDestroyedException _M_Ice.CommunicatorDestroyedException = CommunicatorDestroyedException del CommunicatorDestroyedException -if 'ObjectAdapterDeactivatedException' not in _M_Ice.__dict__: +if "ObjectAdapterDeactivatedException" not in _M_Ice.__dict__: _M_Ice.ObjectAdapterDeactivatedException = Ice.createTempClass() class ObjectAdapterDeactivatedException(Ice.LocalException): @@ -379,7 +450,7 @@ class ObjectAdapterDeactivatedException(Ice.LocalException): name -- Name of the adapter. """ - def __init__(self, name=''): + def __init__(self, name=""): self.name = name def __str__(self): @@ -387,16 +458,24 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ObjectAdapterDeactivatedException' + _ice_id = "::Ice::ObjectAdapterDeactivatedException" _M_Ice._t_ObjectAdapterDeactivatedException = IcePy.defineException( - '::Ice::ObjectAdapterDeactivatedException', ObjectAdapterDeactivatedException, (), False, None, (('name', (), IcePy._t_string, False, 0),)) - ObjectAdapterDeactivatedException._ice_type = _M_Ice._t_ObjectAdapterDeactivatedException + "::Ice::ObjectAdapterDeactivatedException", + ObjectAdapterDeactivatedException, + (), + False, + None, + (("name", (), IcePy._t_string, False, 0),), + ) + ObjectAdapterDeactivatedException._ice_type = ( + _M_Ice._t_ObjectAdapterDeactivatedException + ) _M_Ice.ObjectAdapterDeactivatedException = ObjectAdapterDeactivatedException del ObjectAdapterDeactivatedException -if 'ObjectAdapterIdInUseException' not in _M_Ice.__dict__: +if "ObjectAdapterIdInUseException" not in _M_Ice.__dict__: _M_Ice.ObjectAdapterIdInUseException = Ice.createTempClass() class ObjectAdapterIdInUseException(Ice.LocalException): @@ -407,7 +486,7 @@ class ObjectAdapterIdInUseException(Ice.LocalException): id -- Adapter ID. """ - def __init__(self, id=''): + def __init__(self, id=""): self.id = id def __str__(self): @@ -415,16 +494,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ObjectAdapterIdInUseException' + _ice_id = "::Ice::ObjectAdapterIdInUseException" _M_Ice._t_ObjectAdapterIdInUseException = IcePy.defineException( - '::Ice::ObjectAdapterIdInUseException', ObjectAdapterIdInUseException, (), False, None, (('id', (), IcePy._t_string, False, 0),)) + "::Ice::ObjectAdapterIdInUseException", + ObjectAdapterIdInUseException, + (), + False, + None, + (("id", (), IcePy._t_string, False, 0),), + ) ObjectAdapterIdInUseException._ice_type = _M_Ice._t_ObjectAdapterIdInUseException _M_Ice.ObjectAdapterIdInUseException = ObjectAdapterIdInUseException del ObjectAdapterIdInUseException -if 'NoEndpointException' not in _M_Ice.__dict__: +if "NoEndpointException" not in _M_Ice.__dict__: _M_Ice.NoEndpointException = Ice.createTempClass() class NoEndpointException(Ice.LocalException): @@ -434,7 +519,7 @@ class NoEndpointException(Ice.LocalException): proxy -- The stringified proxy for which no suitable endpoint is available. """ - def __init__(self, proxy=''): + def __init__(self, proxy=""): self.proxy = proxy def __str__(self): @@ -442,16 +527,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::NoEndpointException' + _ice_id = "::Ice::NoEndpointException" _M_Ice._t_NoEndpointException = IcePy.defineException( - '::Ice::NoEndpointException', NoEndpointException, (), False, None, (('proxy', (), IcePy._t_string, False, 0),)) + "::Ice::NoEndpointException", + NoEndpointException, + (), + False, + None, + (("proxy", (), IcePy._t_string, False, 0),), + ) NoEndpointException._ice_type = _M_Ice._t_NoEndpointException _M_Ice.NoEndpointException = NoEndpointException del NoEndpointException -if 'EndpointParseException' not in _M_Ice.__dict__: +if "EndpointParseException" not in _M_Ice.__dict__: _M_Ice.EndpointParseException = Ice.createTempClass() class EndpointParseException(Ice.LocalException): @@ -461,7 +552,7 @@ class EndpointParseException(Ice.LocalException): str -- Describes the failure and includes the string that could not be parsed. """ - def __init__(self, str=''): + def __init__(self, str=""): self.str = str def __str__(self): @@ -469,16 +560,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::EndpointParseException' + _ice_id = "::Ice::EndpointParseException" _M_Ice._t_EndpointParseException = IcePy.defineException( - '::Ice::EndpointParseException', EndpointParseException, (), False, None, (('str', (), IcePy._t_string, False, 0),)) + "::Ice::EndpointParseException", + EndpointParseException, + (), + False, + None, + (("str", (), IcePy._t_string, False, 0),), + ) EndpointParseException._ice_type = _M_Ice._t_EndpointParseException _M_Ice.EndpointParseException = EndpointParseException del EndpointParseException -if 'EndpointSelectionTypeParseException' not in _M_Ice.__dict__: +if "EndpointSelectionTypeParseException" not in _M_Ice.__dict__: _M_Ice.EndpointSelectionTypeParseException = Ice.createTempClass() class EndpointSelectionTypeParseException(Ice.LocalException): @@ -488,7 +585,7 @@ class EndpointSelectionTypeParseException(Ice.LocalException): str -- Describes the failure and includes the string that could not be parsed. """ - def __init__(self, str=''): + def __init__(self, str=""): self.str = str def __str__(self): @@ -496,16 +593,24 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::EndpointSelectionTypeParseException' + _ice_id = "::Ice::EndpointSelectionTypeParseException" _M_Ice._t_EndpointSelectionTypeParseException = IcePy.defineException( - '::Ice::EndpointSelectionTypeParseException', EndpointSelectionTypeParseException, (), False, None, (('str', (), IcePy._t_string, False, 0),)) - EndpointSelectionTypeParseException._ice_type = _M_Ice._t_EndpointSelectionTypeParseException + "::Ice::EndpointSelectionTypeParseException", + EndpointSelectionTypeParseException, + (), + False, + None, + (("str", (), IcePy._t_string, False, 0),), + ) + EndpointSelectionTypeParseException._ice_type = ( + _M_Ice._t_EndpointSelectionTypeParseException + ) _M_Ice.EndpointSelectionTypeParseException = EndpointSelectionTypeParseException del EndpointSelectionTypeParseException -if 'VersionParseException' not in _M_Ice.__dict__: +if "VersionParseException" not in _M_Ice.__dict__: _M_Ice.VersionParseException = Ice.createTempClass() class VersionParseException(Ice.LocalException): @@ -515,7 +620,7 @@ class VersionParseException(Ice.LocalException): str -- Describes the failure and includes the string that could not be parsed. """ - def __init__(self, str=''): + def __init__(self, str=""): self.str = str def __str__(self): @@ -523,16 +628,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::VersionParseException' + _ice_id = "::Ice::VersionParseException" _M_Ice._t_VersionParseException = IcePy.defineException( - '::Ice::VersionParseException', VersionParseException, (), False, None, (('str', (), IcePy._t_string, False, 0),)) + "::Ice::VersionParseException", + VersionParseException, + (), + False, + None, + (("str", (), IcePy._t_string, False, 0),), + ) VersionParseException._ice_type = _M_Ice._t_VersionParseException _M_Ice.VersionParseException = VersionParseException del VersionParseException -if 'IdentityParseException' not in _M_Ice.__dict__: +if "IdentityParseException" not in _M_Ice.__dict__: _M_Ice.IdentityParseException = Ice.createTempClass() class IdentityParseException(Ice.LocalException): @@ -542,7 +653,7 @@ class IdentityParseException(Ice.LocalException): str -- Describes the failure and includes the string that could not be parsed. """ - def __init__(self, str=''): + def __init__(self, str=""): self.str = str def __str__(self): @@ -550,16 +661,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::IdentityParseException' + _ice_id = "::Ice::IdentityParseException" _M_Ice._t_IdentityParseException = IcePy.defineException( - '::Ice::IdentityParseException', IdentityParseException, (), False, None, (('str', (), IcePy._t_string, False, 0),)) + "::Ice::IdentityParseException", + IdentityParseException, + (), + False, + None, + (("str", (), IcePy._t_string, False, 0),), + ) IdentityParseException._ice_type = _M_Ice._t_IdentityParseException _M_Ice.IdentityParseException = IdentityParseException del IdentityParseException -if 'ProxyParseException' not in _M_Ice.__dict__: +if "ProxyParseException" not in _M_Ice.__dict__: _M_Ice.ProxyParseException = Ice.createTempClass() class ProxyParseException(Ice.LocalException): @@ -569,7 +686,7 @@ class ProxyParseException(Ice.LocalException): str -- Describes the failure and includes the string that could not be parsed. """ - def __init__(self, str=''): + def __init__(self, str=""): self.str = str def __str__(self): @@ -577,16 +694,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ProxyParseException' + _ice_id = "::Ice::ProxyParseException" _M_Ice._t_ProxyParseException = IcePy.defineException( - '::Ice::ProxyParseException', ProxyParseException, (), False, None, (('str', (), IcePy._t_string, False, 0),)) + "::Ice::ProxyParseException", + ProxyParseException, + (), + False, + None, + (("str", (), IcePy._t_string, False, 0),), + ) ProxyParseException._ice_type = _M_Ice._t_ProxyParseException _M_Ice.ProxyParseException = ProxyParseException del ProxyParseException -if 'IllegalIdentityException' not in _M_Ice.__dict__: +if "IllegalIdentityException" not in _M_Ice.__dict__: _M_Ice.IllegalIdentityException = Ice.createTempClass() class IllegalIdentityException(Ice.LocalException): @@ -607,16 +730,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::IllegalIdentityException' + _ice_id = "::Ice::IllegalIdentityException" _M_Ice._t_IllegalIdentityException = IcePy.defineException( - '::Ice::IllegalIdentityException', IllegalIdentityException, (), False, None, (('id', (), _M_Ice._t_Identity, False, 0),)) + "::Ice::IllegalIdentityException", + IllegalIdentityException, + (), + False, + None, + (("id", (), _M_Ice._t_Identity, False, 0),), + ) IllegalIdentityException._ice_type = _M_Ice._t_IllegalIdentityException _M_Ice.IllegalIdentityException = IllegalIdentityException del IllegalIdentityException -if 'IllegalServantException' not in _M_Ice.__dict__: +if "IllegalServantException" not in _M_Ice.__dict__: _M_Ice.IllegalServantException = Ice.createTempClass() class IllegalServantException(Ice.LocalException): @@ -626,7 +755,7 @@ class IllegalServantException(Ice.LocalException): reason -- Describes why this servant is illegal. """ - def __init__(self, reason=''): + def __init__(self, reason=""): self.reason = reason def __str__(self): @@ -634,16 +763,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::IllegalServantException' + _ice_id = "::Ice::IllegalServantException" _M_Ice._t_IllegalServantException = IcePy.defineException( - '::Ice::IllegalServantException', IllegalServantException, (), False, None, (('reason', (), IcePy._t_string, False, 0),)) + "::Ice::IllegalServantException", + IllegalServantException, + (), + False, + None, + (("reason", (), IcePy._t_string, False, 0),), + ) IllegalServantException._ice_type = _M_Ice._t_IllegalServantException _M_Ice.IllegalServantException = IllegalServantException del IllegalServantException -if 'RequestFailedException' not in _M_Ice.__dict__: +if "RequestFailedException" not in _M_Ice.__dict__: _M_Ice.RequestFailedException = Ice.createTempClass() class RequestFailedException(Ice.LocalException): @@ -657,7 +792,7 @@ class RequestFailedException(Ice.LocalException): operation -- The operation name of the request. """ - def __init__(self, id=Ice._struct_marker, facet='', operation=''): + def __init__(self, id=Ice._struct_marker, facet="", operation=""): if id is Ice._struct_marker: self.id = _M_Ice.Identity() else: @@ -670,28 +805,35 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::RequestFailedException' + _ice_id = "::Ice::RequestFailedException" - _M_Ice._t_RequestFailedException = IcePy.defineException('::Ice::RequestFailedException', RequestFailedException, (), False, None, ( - ('id', (), _M_Ice._t_Identity, False, 0), - ('facet', (), IcePy._t_string, False, 0), - ('operation', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_RequestFailedException = IcePy.defineException( + "::Ice::RequestFailedException", + RequestFailedException, + (), + False, + None, + ( + ("id", (), _M_Ice._t_Identity, False, 0), + ("facet", (), IcePy._t_string, False, 0), + ("operation", (), IcePy._t_string, False, 0), + ), + ) RequestFailedException._ice_type = _M_Ice._t_RequestFailedException _M_Ice.RequestFailedException = RequestFailedException del RequestFailedException -if 'ObjectNotExistException' not in _M_Ice.__dict__: +if "ObjectNotExistException" not in _M_Ice.__dict__: _M_Ice.ObjectNotExistException = Ice.createTempClass() class ObjectNotExistException(_M_Ice.RequestFailedException): """ - This exception is raised if an object does not exist on the server, that is, if no facets with the given identity - exist. + This exception is raised if an object does not exist on the server, that is, if no facets with the given identity + exist. """ - def __init__(self, id=Ice._struct_marker, facet='', operation=''): + def __init__(self, id=Ice._struct_marker, facet="", operation=""): _M_Ice.RequestFailedException.__init__(self, id, facet, operation) def __str__(self): @@ -699,25 +841,31 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ObjectNotExistException' + _ice_id = "::Ice::ObjectNotExistException" _M_Ice._t_ObjectNotExistException = IcePy.defineException( - '::Ice::ObjectNotExistException', ObjectNotExistException, (), False, _M_Ice._t_RequestFailedException, ()) + "::Ice::ObjectNotExistException", + ObjectNotExistException, + (), + False, + _M_Ice._t_RequestFailedException, + (), + ) ObjectNotExistException._ice_type = _M_Ice._t_ObjectNotExistException _M_Ice.ObjectNotExistException = ObjectNotExistException del ObjectNotExistException -if 'FacetNotExistException' not in _M_Ice.__dict__: +if "FacetNotExistException" not in _M_Ice.__dict__: _M_Ice.FacetNotExistException = Ice.createTempClass() class FacetNotExistException(_M_Ice.RequestFailedException): """ - This exception is raised if no facet with the given name exists, but at least one facet with the given identity - exists. + This exception is raised if no facet with the given name exists, but at least one facet with the given identity + exists. """ - def __init__(self, id=Ice._struct_marker, facet='', operation=''): + def __init__(self, id=Ice._struct_marker, facet="", operation=""): _M_Ice.RequestFailedException.__init__(self, id, facet, operation) def __str__(self): @@ -725,25 +873,31 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::FacetNotExistException' + _ice_id = "::Ice::FacetNotExistException" _M_Ice._t_FacetNotExistException = IcePy.defineException( - '::Ice::FacetNotExistException', FacetNotExistException, (), False, _M_Ice._t_RequestFailedException, ()) + "::Ice::FacetNotExistException", + FacetNotExistException, + (), + False, + _M_Ice._t_RequestFailedException, + (), + ) FacetNotExistException._ice_type = _M_Ice._t_FacetNotExistException _M_Ice.FacetNotExistException = FacetNotExistException del FacetNotExistException -if 'OperationNotExistException' not in _M_Ice.__dict__: +if "OperationNotExistException" not in _M_Ice.__dict__: _M_Ice.OperationNotExistException = Ice.createTempClass() class OperationNotExistException(_M_Ice.RequestFailedException): """ - This exception is raised if an operation for a given object does not exist on the server. Typically this is caused - by either the client or the server using an outdated Slice specification. + This exception is raised if an operation for a given object does not exist on the server. Typically this is caused + by either the client or the server using an outdated Slice specification. """ - def __init__(self, id=Ice._struct_marker, facet='', operation=''): + def __init__(self, id=Ice._struct_marker, facet="", operation=""): _M_Ice.RequestFailedException.__init__(self, id, facet, operation) def __str__(self): @@ -751,16 +905,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::OperationNotExistException' + _ice_id = "::Ice::OperationNotExistException" _M_Ice._t_OperationNotExistException = IcePy.defineException( - '::Ice::OperationNotExistException', OperationNotExistException, (), False, _M_Ice._t_RequestFailedException, ()) + "::Ice::OperationNotExistException", + OperationNotExistException, + (), + False, + _M_Ice._t_RequestFailedException, + (), + ) OperationNotExistException._ice_type = _M_Ice._t_OperationNotExistException _M_Ice.OperationNotExistException = OperationNotExistException del OperationNotExistException -if 'SyscallException' not in _M_Ice.__dict__: +if "SyscallException" not in _M_Ice.__dict__: _M_Ice.SyscallException = Ice.createTempClass() class SyscallException(Ice.LocalException): @@ -781,21 +941,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::SyscallException' + _ice_id = "::Ice::SyscallException" _M_Ice._t_SyscallException = IcePy.defineException( - '::Ice::SyscallException', SyscallException, (), False, None, (('error', (), IcePy._t_int, False, 0),)) + "::Ice::SyscallException", + SyscallException, + (), + False, + None, + (("error", (), IcePy._t_int, False, 0),), + ) SyscallException._ice_type = _M_Ice._t_SyscallException _M_Ice.SyscallException = SyscallException del SyscallException -if 'SocketException' not in _M_Ice.__dict__: +if "SocketException" not in _M_Ice.__dict__: _M_Ice.SocketException = Ice.createTempClass() class SocketException(_M_Ice.SyscallException): """ - This exception indicates socket errors. + This exception indicates socket errors. """ def __init__(self, error=0): @@ -806,16 +972,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::SocketException' + _ice_id = "::Ice::SocketException" _M_Ice._t_SocketException = IcePy.defineException( - '::Ice::SocketException', SocketException, (), False, _M_Ice._t_SyscallException, ()) + "::Ice::SocketException", + SocketException, + (), + False, + _M_Ice._t_SyscallException, + (), + ) SocketException._ice_type = _M_Ice._t_SocketException _M_Ice.SocketException = SocketException del SocketException -if 'CFNetworkException' not in _M_Ice.__dict__: +if "CFNetworkException" not in _M_Ice.__dict__: _M_Ice.CFNetworkException = Ice.createTempClass() class CFNetworkException(_M_Ice.SocketException): @@ -825,7 +997,7 @@ class CFNetworkException(_M_Ice.SocketException): domain -- The domain of the error. """ - def __init__(self, error=0, domain=''): + def __init__(self, error=0, domain=""): _M_Ice.SocketException.__init__(self, error) self.domain = domain @@ -834,16 +1006,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CFNetworkException' + _ice_id = "::Ice::CFNetworkException" _M_Ice._t_CFNetworkException = IcePy.defineException( - '::Ice::CFNetworkException', CFNetworkException, (), False, _M_Ice._t_SocketException, (('domain', (), IcePy._t_string, False, 0),)) + "::Ice::CFNetworkException", + CFNetworkException, + (), + False, + _M_Ice._t_SocketException, + (("domain", (), IcePy._t_string, False, 0),), + ) CFNetworkException._ice_type = _M_Ice._t_CFNetworkException _M_Ice.CFNetworkException = CFNetworkException del CFNetworkException -if 'FileException' not in _M_Ice.__dict__: +if "FileException" not in _M_Ice.__dict__: _M_Ice.FileException = Ice.createTempClass() class FileException(_M_Ice.SyscallException): @@ -853,7 +1031,7 @@ class FileException(_M_Ice.SyscallException): path -- The path of the file responsible for the error. """ - def __init__(self, error=0, path=''): + def __init__(self, error=0, path=""): _M_Ice.SyscallException.__init__(self, error) self.path = path @@ -862,21 +1040,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::FileException' + _ice_id = "::Ice::FileException" _M_Ice._t_FileException = IcePy.defineException( - '::Ice::FileException', FileException, (), False, _M_Ice._t_SyscallException, (('path', (), IcePy._t_string, False, 0),)) + "::Ice::FileException", + FileException, + (), + False, + _M_Ice._t_SyscallException, + (("path", (), IcePy._t_string, False, 0),), + ) FileException._ice_type = _M_Ice._t_FileException _M_Ice.FileException = FileException del FileException -if 'ConnectFailedException' not in _M_Ice.__dict__: +if "ConnectFailedException" not in _M_Ice.__dict__: _M_Ice.ConnectFailedException = Ice.createTempClass() class ConnectFailedException(_M_Ice.SocketException): """ - This exception indicates connection failures. + This exception indicates connection failures. """ def __init__(self, error=0): @@ -887,21 +1071,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectFailedException' + _ice_id = "::Ice::ConnectFailedException" _M_Ice._t_ConnectFailedException = IcePy.defineException( - '::Ice::ConnectFailedException', ConnectFailedException, (), False, _M_Ice._t_SocketException, ()) + "::Ice::ConnectFailedException", + ConnectFailedException, + (), + False, + _M_Ice._t_SocketException, + (), + ) ConnectFailedException._ice_type = _M_Ice._t_ConnectFailedException _M_Ice.ConnectFailedException = ConnectFailedException del ConnectFailedException -if 'ConnectionRefusedException' not in _M_Ice.__dict__: +if "ConnectionRefusedException" not in _M_Ice.__dict__: _M_Ice.ConnectionRefusedException = Ice.createTempClass() class ConnectionRefusedException(_M_Ice.ConnectFailedException): """ - This exception indicates a connection failure for which the server host actively refuses a connection. + This exception indicates a connection failure for which the server host actively refuses a connection. """ def __init__(self, error=0): @@ -912,21 +1102,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectionRefusedException' + _ice_id = "::Ice::ConnectionRefusedException" _M_Ice._t_ConnectionRefusedException = IcePy.defineException( - '::Ice::ConnectionRefusedException', ConnectionRefusedException, (), False, _M_Ice._t_ConnectFailedException, ()) + "::Ice::ConnectionRefusedException", + ConnectionRefusedException, + (), + False, + _M_Ice._t_ConnectFailedException, + (), + ) ConnectionRefusedException._ice_type = _M_Ice._t_ConnectionRefusedException _M_Ice.ConnectionRefusedException = ConnectionRefusedException del ConnectionRefusedException -if 'ConnectionLostException' not in _M_Ice.__dict__: +if "ConnectionLostException" not in _M_Ice.__dict__: _M_Ice.ConnectionLostException = Ice.createTempClass() class ConnectionLostException(_M_Ice.SocketException): """ - This exception indicates a lost connection. + This exception indicates a lost connection. """ def __init__(self, error=0): @@ -937,16 +1133,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectionLostException' + _ice_id = "::Ice::ConnectionLostException" _M_Ice._t_ConnectionLostException = IcePy.defineException( - '::Ice::ConnectionLostException', ConnectionLostException, (), False, _M_Ice._t_SocketException, ()) + "::Ice::ConnectionLostException", + ConnectionLostException, + (), + False, + _M_Ice._t_SocketException, + (), + ) ConnectionLostException._ice_type = _M_Ice._t_ConnectionLostException _M_Ice.ConnectionLostException = ConnectionLostException del ConnectionLostException -if 'DNSException' not in _M_Ice.__dict__: +if "DNSException" not in _M_Ice.__dict__: _M_Ice.DNSException = Ice.createTempClass() class DNSException(Ice.LocalException): @@ -958,7 +1160,7 @@ class DNSException(Ice.LocalException): host -- The host name that could not be resolved. """ - def __init__(self, error=0, host=''): + def __init__(self, error=0, host=""): self.error = error self.host = host @@ -967,23 +1169,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::DNSException' + _ice_id = "::Ice::DNSException" - _M_Ice._t_DNSException = IcePy.defineException('::Ice::DNSException', DNSException, (), False, None, ( - ('error', (), IcePy._t_int, False, 0), - ('host', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_DNSException = IcePy.defineException( + "::Ice::DNSException", + DNSException, + (), + False, + None, + ( + ("error", (), IcePy._t_int, False, 0), + ("host", (), IcePy._t_string, False, 0), + ), + ) DNSException._ice_type = _M_Ice._t_DNSException _M_Ice.DNSException = DNSException del DNSException -if 'OperationInterruptedException' not in _M_Ice.__dict__: +if "OperationInterruptedException" not in _M_Ice.__dict__: _M_Ice.OperationInterruptedException = Ice.createTempClass() class OperationInterruptedException(Ice.LocalException): """ - This exception indicates a request was interrupted. + This exception indicates a request was interrupted. """ def __init__(self): @@ -994,21 +1203,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::OperationInterruptedException' + _ice_id = "::Ice::OperationInterruptedException" _M_Ice._t_OperationInterruptedException = IcePy.defineException( - '::Ice::OperationInterruptedException', OperationInterruptedException, (), False, None, ()) + "::Ice::OperationInterruptedException", + OperationInterruptedException, + (), + False, + None, + (), + ) OperationInterruptedException._ice_type = _M_Ice._t_OperationInterruptedException _M_Ice.OperationInterruptedException = OperationInterruptedException del OperationInterruptedException -if 'TimeoutException' not in _M_Ice.__dict__: +if "TimeoutException" not in _M_Ice.__dict__: _M_Ice.TimeoutException = Ice.createTempClass() class TimeoutException(Ice.LocalException): """ - This exception indicates a timeout condition. + This exception indicates a timeout condition. """ def __init__(self): @@ -1019,20 +1234,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::TimeoutException' + _ice_id = "::Ice::TimeoutException" - _M_Ice._t_TimeoutException = IcePy.defineException('::Ice::TimeoutException', TimeoutException, (), False, None, ()) + _M_Ice._t_TimeoutException = IcePy.defineException( + "::Ice::TimeoutException", TimeoutException, (), False, None, () + ) TimeoutException._ice_type = _M_Ice._t_TimeoutException _M_Ice.TimeoutException = TimeoutException del TimeoutException -if 'ConnectTimeoutException' not in _M_Ice.__dict__: +if "ConnectTimeoutException" not in _M_Ice.__dict__: _M_Ice.ConnectTimeoutException = Ice.createTempClass() class ConnectTimeoutException(_M_Ice.TimeoutException): """ - This exception indicates a connection establishment timeout condition. + This exception indicates a connection establishment timeout condition. """ def __init__(self): @@ -1043,21 +1260,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectTimeoutException' + _ice_id = "::Ice::ConnectTimeoutException" _M_Ice._t_ConnectTimeoutException = IcePy.defineException( - '::Ice::ConnectTimeoutException', ConnectTimeoutException, (), False, _M_Ice._t_TimeoutException, ()) + "::Ice::ConnectTimeoutException", + ConnectTimeoutException, + (), + False, + _M_Ice._t_TimeoutException, + (), + ) ConnectTimeoutException._ice_type = _M_Ice._t_ConnectTimeoutException _M_Ice.ConnectTimeoutException = ConnectTimeoutException del ConnectTimeoutException -if 'CloseTimeoutException' not in _M_Ice.__dict__: +if "CloseTimeoutException" not in _M_Ice.__dict__: _M_Ice.CloseTimeoutException = Ice.createTempClass() class CloseTimeoutException(_M_Ice.TimeoutException): """ - This exception indicates a connection closure timeout condition. + This exception indicates a connection closure timeout condition. """ def __init__(self): @@ -1068,21 +1291,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CloseTimeoutException' + _ice_id = "::Ice::CloseTimeoutException" _M_Ice._t_CloseTimeoutException = IcePy.defineException( - '::Ice::CloseTimeoutException', CloseTimeoutException, (), False, _M_Ice._t_TimeoutException, ()) + "::Ice::CloseTimeoutException", + CloseTimeoutException, + (), + False, + _M_Ice._t_TimeoutException, + (), + ) CloseTimeoutException._ice_type = _M_Ice._t_CloseTimeoutException _M_Ice.CloseTimeoutException = CloseTimeoutException del CloseTimeoutException -if 'ConnectionTimeoutException' not in _M_Ice.__dict__: +if "ConnectionTimeoutException" not in _M_Ice.__dict__: _M_Ice.ConnectionTimeoutException = Ice.createTempClass() class ConnectionTimeoutException(_M_Ice.TimeoutException): """ - This exception indicates that a connection has been shut down because it has been idle for some time. + This exception indicates that a connection has been shut down because it has been idle for some time. """ def __init__(self): @@ -1093,21 +1322,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectionTimeoutException' + _ice_id = "::Ice::ConnectionTimeoutException" _M_Ice._t_ConnectionTimeoutException = IcePy.defineException( - '::Ice::ConnectionTimeoutException', ConnectionTimeoutException, (), False, _M_Ice._t_TimeoutException, ()) + "::Ice::ConnectionTimeoutException", + ConnectionTimeoutException, + (), + False, + _M_Ice._t_TimeoutException, + (), + ) ConnectionTimeoutException._ice_type = _M_Ice._t_ConnectionTimeoutException _M_Ice.ConnectionTimeoutException = ConnectionTimeoutException del ConnectionTimeoutException -if 'InvocationTimeoutException' not in _M_Ice.__dict__: +if "InvocationTimeoutException" not in _M_Ice.__dict__: _M_Ice.InvocationTimeoutException = Ice.createTempClass() class InvocationTimeoutException(_M_Ice.TimeoutException): """ - This exception indicates that an invocation failed because it timed out. + This exception indicates that an invocation failed because it timed out. """ def __init__(self): @@ -1118,21 +1353,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::InvocationTimeoutException' + _ice_id = "::Ice::InvocationTimeoutException" _M_Ice._t_InvocationTimeoutException = IcePy.defineException( - '::Ice::InvocationTimeoutException', InvocationTimeoutException, (), False, _M_Ice._t_TimeoutException, ()) + "::Ice::InvocationTimeoutException", + InvocationTimeoutException, + (), + False, + _M_Ice._t_TimeoutException, + (), + ) InvocationTimeoutException._ice_type = _M_Ice._t_InvocationTimeoutException _M_Ice.InvocationTimeoutException = InvocationTimeoutException del InvocationTimeoutException -if 'InvocationCanceledException' not in _M_Ice.__dict__: +if "InvocationCanceledException" not in _M_Ice.__dict__: _M_Ice.InvocationCanceledException = Ice.createTempClass() class InvocationCanceledException(Ice.LocalException): """ - This exception indicates that an asynchronous invocation failed because it was canceled explicitly by the user. + This exception indicates that an asynchronous invocation failed because it was canceled explicitly by the user. """ def __init__(self): @@ -1143,16 +1384,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::InvocationCanceledException' + _ice_id = "::Ice::InvocationCanceledException" _M_Ice._t_InvocationCanceledException = IcePy.defineException( - '::Ice::InvocationCanceledException', InvocationCanceledException, (), False, None, ()) + "::Ice::InvocationCanceledException", + InvocationCanceledException, + (), + False, + None, + (), + ) InvocationCanceledException._ice_type = _M_Ice._t_InvocationCanceledException _M_Ice.InvocationCanceledException = InvocationCanceledException del InvocationCanceledException -if 'ProtocolException' not in _M_Ice.__dict__: +if "ProtocolException" not in _M_Ice.__dict__: _M_Ice.ProtocolException = Ice.createTempClass() class ProtocolException(Ice.LocalException): @@ -1162,7 +1409,7 @@ class ProtocolException(Ice.LocalException): reason -- The reason for the failure. """ - def __init__(self, reason=''): + def __init__(self, reason=""): self.reason = reason def __str__(self): @@ -1170,16 +1417,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ProtocolException' + _ice_id = "::Ice::ProtocolException" _M_Ice._t_ProtocolException = IcePy.defineException( - '::Ice::ProtocolException', ProtocolException, (), False, None, (('reason', (), IcePy._t_string, False, 0),)) + "::Ice::ProtocolException", + ProtocolException, + (), + False, + None, + (("reason", (), IcePy._t_string, False, 0),), + ) ProtocolException._ice_type = _M_Ice._t_ProtocolException _M_Ice.ProtocolException = ProtocolException del ProtocolException -if 'BadMagicException' not in _M_Ice.__dict__: +if "BadMagicException" not in _M_Ice.__dict__: _M_Ice.BadMagicException = Ice.createTempClass() class BadMagicException(_M_Ice.ProtocolException): @@ -1189,7 +1442,7 @@ class BadMagicException(_M_Ice.ProtocolException): badMagic -- A sequence containing the first four bytes of the incorrect message. """ - def __init__(self, reason='', badMagic=None): + def __init__(self, reason="", badMagic=None): _M_Ice.ProtocolException.__init__(self, reason) self.badMagic = badMagic @@ -1198,16 +1451,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::BadMagicException' + _ice_id = "::Ice::BadMagicException" _M_Ice._t_BadMagicException = IcePy.defineException( - '::Ice::BadMagicException', BadMagicException, (), False, _M_Ice._t_ProtocolException, (('badMagic', (), _M_Ice._t_ByteSeq, False, 0),)) + "::Ice::BadMagicException", + BadMagicException, + (), + False, + _M_Ice._t_ProtocolException, + (("badMagic", (), _M_Ice._t_ByteSeq, False, 0),), + ) BadMagicException._ice_type = _M_Ice._t_BadMagicException _M_Ice.BadMagicException = BadMagicException del BadMagicException -if 'UnsupportedProtocolException' not in _M_Ice.__dict__: +if "UnsupportedProtocolException" not in _M_Ice.__dict__: _M_Ice.UnsupportedProtocolException = Ice.createTempClass() class UnsupportedProtocolException(_M_Ice.ProtocolException): @@ -1218,7 +1477,9 @@ class UnsupportedProtocolException(_M_Ice.ProtocolException): supported -- The version of the protocol that is supported. """ - def __init__(self, reason='', bad=Ice._struct_marker, supported=Ice._struct_marker): + def __init__( + self, reason="", bad=Ice._struct_marker, supported=Ice._struct_marker + ): _M_Ice.ProtocolException.__init__(self, reason) if bad is Ice._struct_marker: self.bad = _M_Ice.ProtocolVersion() @@ -1234,18 +1495,25 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnsupportedProtocolException' + _ice_id = "::Ice::UnsupportedProtocolException" - _M_Ice._t_UnsupportedProtocolException = IcePy.defineException('::Ice::UnsupportedProtocolException', UnsupportedProtocolException, (), False, _M_Ice._t_ProtocolException, ( - ('bad', (), _M_Ice._t_ProtocolVersion, False, 0), - ('supported', (), _M_Ice._t_ProtocolVersion, False, 0) - )) + _M_Ice._t_UnsupportedProtocolException = IcePy.defineException( + "::Ice::UnsupportedProtocolException", + UnsupportedProtocolException, + (), + False, + _M_Ice._t_ProtocolException, + ( + ("bad", (), _M_Ice._t_ProtocolVersion, False, 0), + ("supported", (), _M_Ice._t_ProtocolVersion, False, 0), + ), + ) UnsupportedProtocolException._ice_type = _M_Ice._t_UnsupportedProtocolException _M_Ice.UnsupportedProtocolException = UnsupportedProtocolException del UnsupportedProtocolException -if 'UnsupportedEncodingException' not in _M_Ice.__dict__: +if "UnsupportedEncodingException" not in _M_Ice.__dict__: _M_Ice.UnsupportedEncodingException = Ice.createTempClass() class UnsupportedEncodingException(_M_Ice.ProtocolException): @@ -1256,7 +1524,9 @@ class UnsupportedEncodingException(_M_Ice.ProtocolException): supported -- The version of the encoding that is supported. """ - def __init__(self, reason='', bad=Ice._struct_marker, supported=Ice._struct_marker): + def __init__( + self, reason="", bad=Ice._struct_marker, supported=Ice._struct_marker + ): _M_Ice.ProtocolException.__init__(self, reason) if bad is Ice._struct_marker: self.bad = _M_Ice.EncodingVersion() @@ -1272,26 +1542,33 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnsupportedEncodingException' + _ice_id = "::Ice::UnsupportedEncodingException" - _M_Ice._t_UnsupportedEncodingException = IcePy.defineException('::Ice::UnsupportedEncodingException', UnsupportedEncodingException, (), False, _M_Ice._t_ProtocolException, ( - ('bad', (), _M_Ice._t_EncodingVersion, False, 0), - ('supported', (), _M_Ice._t_EncodingVersion, False, 0) - )) + _M_Ice._t_UnsupportedEncodingException = IcePy.defineException( + "::Ice::UnsupportedEncodingException", + UnsupportedEncodingException, + (), + False, + _M_Ice._t_ProtocolException, + ( + ("bad", (), _M_Ice._t_EncodingVersion, False, 0), + ("supported", (), _M_Ice._t_EncodingVersion, False, 0), + ), + ) UnsupportedEncodingException._ice_type = _M_Ice._t_UnsupportedEncodingException _M_Ice.UnsupportedEncodingException = UnsupportedEncodingException del UnsupportedEncodingException -if 'UnknownMessageException' not in _M_Ice.__dict__: +if "UnknownMessageException" not in _M_Ice.__dict__: _M_Ice.UnknownMessageException = Ice.createTempClass() class UnknownMessageException(_M_Ice.ProtocolException): """ - This exception indicates that an unknown protocol message has been received. + This exception indicates that an unknown protocol message has been received. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1299,24 +1576,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnknownMessageException' + _ice_id = "::Ice::UnknownMessageException" _M_Ice._t_UnknownMessageException = IcePy.defineException( - '::Ice::UnknownMessageException', UnknownMessageException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::UnknownMessageException", + UnknownMessageException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) UnknownMessageException._ice_type = _M_Ice._t_UnknownMessageException _M_Ice.UnknownMessageException = UnknownMessageException del UnknownMessageException -if 'ConnectionNotValidatedException' not in _M_Ice.__dict__: +if "ConnectionNotValidatedException" not in _M_Ice.__dict__: _M_Ice.ConnectionNotValidatedException = Ice.createTempClass() class ConnectionNotValidatedException(_M_Ice.ProtocolException): """ - This exception is raised if a message is received over a connection that is not yet validated. + This exception is raised if a message is received over a connection that is not yet validated. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1324,24 +1607,32 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectionNotValidatedException' + _ice_id = "::Ice::ConnectionNotValidatedException" _M_Ice._t_ConnectionNotValidatedException = IcePy.defineException( - '::Ice::ConnectionNotValidatedException', ConnectionNotValidatedException, (), False, _M_Ice._t_ProtocolException, ()) - ConnectionNotValidatedException._ice_type = _M_Ice._t_ConnectionNotValidatedException + "::Ice::ConnectionNotValidatedException", + ConnectionNotValidatedException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) + ConnectionNotValidatedException._ice_type = ( + _M_Ice._t_ConnectionNotValidatedException + ) _M_Ice.ConnectionNotValidatedException = ConnectionNotValidatedException del ConnectionNotValidatedException -if 'UnknownRequestIdException' not in _M_Ice.__dict__: +if "UnknownRequestIdException" not in _M_Ice.__dict__: _M_Ice.UnknownRequestIdException = Ice.createTempClass() class UnknownRequestIdException(_M_Ice.ProtocolException): """ - This exception indicates that a response for an unknown request ID has been received. + This exception indicates that a response for an unknown request ID has been received. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1349,24 +1640,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnknownRequestIdException' + _ice_id = "::Ice::UnknownRequestIdException" _M_Ice._t_UnknownRequestIdException = IcePy.defineException( - '::Ice::UnknownRequestIdException', UnknownRequestIdException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::UnknownRequestIdException", + UnknownRequestIdException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) UnknownRequestIdException._ice_type = _M_Ice._t_UnknownRequestIdException _M_Ice.UnknownRequestIdException = UnknownRequestIdException del UnknownRequestIdException -if 'UnknownReplyStatusException' not in _M_Ice.__dict__: +if "UnknownReplyStatusException" not in _M_Ice.__dict__: _M_Ice.UnknownReplyStatusException = Ice.createTempClass() class UnknownReplyStatusException(_M_Ice.ProtocolException): """ - This exception indicates that an unknown reply status has been received. + This exception indicates that an unknown reply status has been received. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1374,28 +1671,34 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnknownReplyStatusException' + _ice_id = "::Ice::UnknownReplyStatusException" _M_Ice._t_UnknownReplyStatusException = IcePy.defineException( - '::Ice::UnknownReplyStatusException', UnknownReplyStatusException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::UnknownReplyStatusException", + UnknownReplyStatusException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) UnknownReplyStatusException._ice_type = _M_Ice._t_UnknownReplyStatusException _M_Ice.UnknownReplyStatusException = UnknownReplyStatusException del UnknownReplyStatusException -if 'CloseConnectionException' not in _M_Ice.__dict__: +if "CloseConnectionException" not in _M_Ice.__dict__: _M_Ice.CloseConnectionException = Ice.createTempClass() class CloseConnectionException(_M_Ice.ProtocolException): """ - This exception indicates that the connection has been gracefully shut down by the server. The operation call that - caused this exception has not been executed by the server. In most cases you will not get this exception, because - the client will automatically retry the operation call in case the server shut down the connection. However, if - upon retry the server shuts down the connection again, and the retry limit has been reached, then this exception is - propagated to the application code. + This exception indicates that the connection has been gracefully shut down by the server. The operation call that + caused this exception has not been executed by the server. In most cases you will not get this exception, because + the client will automatically retry the operation call in case the server shut down the connection. However, if + upon retry the server shuts down the connection again, and the retry limit has been reached, then this exception is + propagated to the application code. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1403,16 +1706,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CloseConnectionException' + _ice_id = "::Ice::CloseConnectionException" _M_Ice._t_CloseConnectionException = IcePy.defineException( - '::Ice::CloseConnectionException', CloseConnectionException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::CloseConnectionException", + CloseConnectionException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) CloseConnectionException._ice_type = _M_Ice._t_CloseConnectionException _M_Ice.CloseConnectionException = CloseConnectionException del CloseConnectionException -if 'ConnectionManuallyClosedException' not in _M_Ice.__dict__: +if "ConnectionManuallyClosedException" not in _M_Ice.__dict__: _M_Ice.ConnectionManuallyClosedException = Ice.createTempClass() class ConnectionManuallyClosedException(Ice.LocalException): @@ -1431,24 +1740,32 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ConnectionManuallyClosedException' + _ice_id = "::Ice::ConnectionManuallyClosedException" _M_Ice._t_ConnectionManuallyClosedException = IcePy.defineException( - '::Ice::ConnectionManuallyClosedException', ConnectionManuallyClosedException, (), False, None, (('graceful', (), IcePy._t_bool, False, 0),)) - ConnectionManuallyClosedException._ice_type = _M_Ice._t_ConnectionManuallyClosedException + "::Ice::ConnectionManuallyClosedException", + ConnectionManuallyClosedException, + (), + False, + None, + (("graceful", (), IcePy._t_bool, False, 0),), + ) + ConnectionManuallyClosedException._ice_type = ( + _M_Ice._t_ConnectionManuallyClosedException + ) _M_Ice.ConnectionManuallyClosedException = ConnectionManuallyClosedException del ConnectionManuallyClosedException -if 'IllegalMessageSizeException' not in _M_Ice.__dict__: +if "IllegalMessageSizeException" not in _M_Ice.__dict__: _M_Ice.IllegalMessageSizeException = Ice.createTempClass() class IllegalMessageSizeException(_M_Ice.ProtocolException): """ - This exception indicates that a message size is less than the minimum required size. + This exception indicates that a message size is less than the minimum required size. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1456,24 +1773,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::IllegalMessageSizeException' + _ice_id = "::Ice::IllegalMessageSizeException" _M_Ice._t_IllegalMessageSizeException = IcePy.defineException( - '::Ice::IllegalMessageSizeException', IllegalMessageSizeException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::IllegalMessageSizeException", + IllegalMessageSizeException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) IllegalMessageSizeException._ice_type = _M_Ice._t_IllegalMessageSizeException _M_Ice.IllegalMessageSizeException = IllegalMessageSizeException del IllegalMessageSizeException -if 'CompressionException' not in _M_Ice.__dict__: +if "CompressionException" not in _M_Ice.__dict__: _M_Ice.CompressionException = Ice.createTempClass() class CompressionException(_M_Ice.ProtocolException): """ - This exception indicates a problem with compressing or uncompressing data. + This exception indicates a problem with compressing or uncompressing data. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1481,25 +1804,31 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::CompressionException' + _ice_id = "::Ice::CompressionException" _M_Ice._t_CompressionException = IcePy.defineException( - '::Ice::CompressionException', CompressionException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::CompressionException", + CompressionException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) CompressionException._ice_type = _M_Ice._t_CompressionException _M_Ice.CompressionException = CompressionException del CompressionException -if 'DatagramLimitException' not in _M_Ice.__dict__: +if "DatagramLimitException" not in _M_Ice.__dict__: _M_Ice.DatagramLimitException = Ice.createTempClass() class DatagramLimitException(_M_Ice.ProtocolException): """ - A datagram exceeds the configured size. This exception is raised if a datagram exceeds the configured send or - receive buffer size, or exceeds the maximum payload size of a UDP packet (65507 bytes). + A datagram exceeds the configured size. This exception is raised if a datagram exceeds the configured send or + receive buffer size, or exceeds the maximum payload size of a UDP packet (65507 bytes). """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1507,24 +1836,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::DatagramLimitException' + _ice_id = "::Ice::DatagramLimitException" _M_Ice._t_DatagramLimitException = IcePy.defineException( - '::Ice::DatagramLimitException', DatagramLimitException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::DatagramLimitException", + DatagramLimitException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) DatagramLimitException._ice_type = _M_Ice._t_DatagramLimitException _M_Ice.DatagramLimitException = DatagramLimitException del DatagramLimitException -if 'MarshalException' not in _M_Ice.__dict__: +if "MarshalException" not in _M_Ice.__dict__: _M_Ice.MarshalException = Ice.createTempClass() class MarshalException(_M_Ice.ProtocolException): """ - This exception is raised for errors during marshaling or unmarshaling data. + This exception is raised for errors during marshaling or unmarshaling data. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.ProtocolException.__init__(self, reason) def __str__(self): @@ -1532,24 +1867,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::MarshalException' + _ice_id = "::Ice::MarshalException" _M_Ice._t_MarshalException = IcePy.defineException( - '::Ice::MarshalException', MarshalException, (), False, _M_Ice._t_ProtocolException, ()) + "::Ice::MarshalException", + MarshalException, + (), + False, + _M_Ice._t_ProtocolException, + (), + ) MarshalException._ice_type = _M_Ice._t_MarshalException _M_Ice.MarshalException = MarshalException del MarshalException -if 'ProxyUnmarshalException' not in _M_Ice.__dict__: +if "ProxyUnmarshalException" not in _M_Ice.__dict__: _M_Ice.ProxyUnmarshalException = Ice.createTempClass() class ProxyUnmarshalException(_M_Ice.MarshalException): """ - This exception is raised if inconsistent data is received while unmarshaling a proxy. + This exception is raised if inconsistent data is received while unmarshaling a proxy. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.MarshalException.__init__(self, reason) def __str__(self): @@ -1557,24 +1898,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ProxyUnmarshalException' + _ice_id = "::Ice::ProxyUnmarshalException" _M_Ice._t_ProxyUnmarshalException = IcePy.defineException( - '::Ice::ProxyUnmarshalException', ProxyUnmarshalException, (), False, _M_Ice._t_MarshalException, ()) + "::Ice::ProxyUnmarshalException", + ProxyUnmarshalException, + (), + False, + _M_Ice._t_MarshalException, + (), + ) ProxyUnmarshalException._ice_type = _M_Ice._t_ProxyUnmarshalException _M_Ice.ProxyUnmarshalException = ProxyUnmarshalException del ProxyUnmarshalException -if 'UnmarshalOutOfBoundsException' not in _M_Ice.__dict__: +if "UnmarshalOutOfBoundsException" not in _M_Ice.__dict__: _M_Ice.UnmarshalOutOfBoundsException = Ice.createTempClass() class UnmarshalOutOfBoundsException(_M_Ice.MarshalException): """ - This exception is raised if an out-of-bounds condition occurs during unmarshaling. + This exception is raised if an out-of-bounds condition occurs during unmarshaling. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.MarshalException.__init__(self, reason) def __str__(self): @@ -1582,16 +1929,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnmarshalOutOfBoundsException' + _ice_id = "::Ice::UnmarshalOutOfBoundsException" _M_Ice._t_UnmarshalOutOfBoundsException = IcePy.defineException( - '::Ice::UnmarshalOutOfBoundsException', UnmarshalOutOfBoundsException, (), False, _M_Ice._t_MarshalException, ()) + "::Ice::UnmarshalOutOfBoundsException", + UnmarshalOutOfBoundsException, + (), + False, + _M_Ice._t_MarshalException, + (), + ) UnmarshalOutOfBoundsException._ice_type = _M_Ice._t_UnmarshalOutOfBoundsException _M_Ice.UnmarshalOutOfBoundsException = UnmarshalOutOfBoundsException del UnmarshalOutOfBoundsException -if 'NoValueFactoryException' not in _M_Ice.__dict__: +if "NoValueFactoryException" not in _M_Ice.__dict__: _M_Ice.NoValueFactoryException = Ice.createTempClass() class NoValueFactoryException(_M_Ice.MarshalException): @@ -1601,7 +1954,7 @@ class NoValueFactoryException(_M_Ice.MarshalException): type -- The Slice type ID of the class instance for which no factory could be found. """ - def __init__(self, reason='', type=''): + def __init__(self, reason="", type=""): _M_Ice.MarshalException.__init__(self, reason) self.type = type @@ -1610,16 +1963,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::NoValueFactoryException' + _ice_id = "::Ice::NoValueFactoryException" _M_Ice._t_NoValueFactoryException = IcePy.defineException( - '::Ice::NoValueFactoryException', NoValueFactoryException, (), False, _M_Ice._t_MarshalException, (('type', (), IcePy._t_string, False, 0),)) + "::Ice::NoValueFactoryException", + NoValueFactoryException, + (), + False, + _M_Ice._t_MarshalException, + (("type", (), IcePy._t_string, False, 0),), + ) NoValueFactoryException._ice_type = _M_Ice._t_NoValueFactoryException _M_Ice.NoValueFactoryException = NoValueFactoryException del NoValueFactoryException -if 'UnexpectedObjectException' not in _M_Ice.__dict__: +if "UnexpectedObjectException" not in _M_Ice.__dict__: _M_Ice.UnexpectedObjectException = Ice.createTempClass() class UnexpectedObjectException(_M_Ice.MarshalException): @@ -1633,7 +1992,7 @@ class UnexpectedObjectException(_M_Ice.MarshalException): expectedType -- The Slice type ID that was expected by the receiving operation. """ - def __init__(self, reason='', type='', expectedType=''): + def __init__(self, reason="", type="", expectedType=""): _M_Ice.MarshalException.__init__(self, reason) self.type = type self.expectedType = expectedType @@ -1643,27 +2002,34 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::UnexpectedObjectException' + _ice_id = "::Ice::UnexpectedObjectException" - _M_Ice._t_UnexpectedObjectException = IcePy.defineException('::Ice::UnexpectedObjectException', UnexpectedObjectException, (), False, _M_Ice._t_MarshalException, ( - ('type', (), IcePy._t_string, False, 0), - ('expectedType', (), IcePy._t_string, False, 0) - )) + _M_Ice._t_UnexpectedObjectException = IcePy.defineException( + "::Ice::UnexpectedObjectException", + UnexpectedObjectException, + (), + False, + _M_Ice._t_MarshalException, + ( + ("type", (), IcePy._t_string, False, 0), + ("expectedType", (), IcePy._t_string, False, 0), + ), + ) UnexpectedObjectException._ice_type = _M_Ice._t_UnexpectedObjectException _M_Ice.UnexpectedObjectException = UnexpectedObjectException del UnexpectedObjectException -if 'MemoryLimitException' not in _M_Ice.__dict__: +if "MemoryLimitException" not in _M_Ice.__dict__: _M_Ice.MemoryLimitException = Ice.createTempClass() class MemoryLimitException(_M_Ice.MarshalException): """ - This exception is raised when Ice receives a request or reply message whose size exceeds the limit specified by the - Ice.MessageSizeMax property. + This exception is raised when Ice receives a request or reply message whose size exceeds the limit specified by the + Ice.MessageSizeMax property. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.MarshalException.__init__(self, reason) def __str__(self): @@ -1671,24 +2037,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::MemoryLimitException' + _ice_id = "::Ice::MemoryLimitException" _M_Ice._t_MemoryLimitException = IcePy.defineException( - '::Ice::MemoryLimitException', MemoryLimitException, (), False, _M_Ice._t_MarshalException, ()) + "::Ice::MemoryLimitException", + MemoryLimitException, + (), + False, + _M_Ice._t_MarshalException, + (), + ) MemoryLimitException._ice_type = _M_Ice._t_MemoryLimitException _M_Ice.MemoryLimitException = MemoryLimitException del MemoryLimitException -if 'StringConversionException' not in _M_Ice.__dict__: +if "StringConversionException" not in _M_Ice.__dict__: _M_Ice.StringConversionException = Ice.createTempClass() class StringConversionException(_M_Ice.MarshalException): """ - This exception is raised when a string conversion to or from UTF-8 fails during marshaling or unmarshaling. + This exception is raised when a string conversion to or from UTF-8 fails during marshaling or unmarshaling. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.MarshalException.__init__(self, reason) def __str__(self): @@ -1696,24 +2068,30 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::StringConversionException' + _ice_id = "::Ice::StringConversionException" _M_Ice._t_StringConversionException = IcePy.defineException( - '::Ice::StringConversionException', StringConversionException, (), False, _M_Ice._t_MarshalException, ()) + "::Ice::StringConversionException", + StringConversionException, + (), + False, + _M_Ice._t_MarshalException, + (), + ) StringConversionException._ice_type = _M_Ice._t_StringConversionException _M_Ice.StringConversionException = StringConversionException del StringConversionException -if 'EncapsulationException' not in _M_Ice.__dict__: +if "EncapsulationException" not in _M_Ice.__dict__: _M_Ice.EncapsulationException = Ice.createTempClass() class EncapsulationException(_M_Ice.MarshalException): """ - This exception indicates a malformed data encapsulation. + This exception indicates a malformed data encapsulation. """ - def __init__(self, reason=''): + def __init__(self, reason=""): _M_Ice.MarshalException.__init__(self, reason) def __str__(self): @@ -1721,16 +2099,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::EncapsulationException' + _ice_id = "::Ice::EncapsulationException" _M_Ice._t_EncapsulationException = IcePy.defineException( - '::Ice::EncapsulationException', EncapsulationException, (), False, _M_Ice._t_MarshalException, ()) + "::Ice::EncapsulationException", + EncapsulationException, + (), + False, + _M_Ice._t_MarshalException, + (), + ) EncapsulationException._ice_type = _M_Ice._t_EncapsulationException _M_Ice.EncapsulationException = EncapsulationException del EncapsulationException -if 'FeatureNotSupportedException' not in _M_Ice.__dict__: +if "FeatureNotSupportedException" not in _M_Ice.__dict__: _M_Ice.FeatureNotSupportedException = Ice.createTempClass() class FeatureNotSupportedException(Ice.LocalException): @@ -1741,7 +2125,7 @@ class FeatureNotSupportedException(Ice.LocalException): unsupportedFeature -- The name of the unsupported feature. """ - def __init__(self, unsupportedFeature=''): + def __init__(self, unsupportedFeature=""): self.unsupportedFeature = unsupportedFeature def __str__(self): @@ -1749,16 +2133,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::FeatureNotSupportedException' + _ice_id = "::Ice::FeatureNotSupportedException" _M_Ice._t_FeatureNotSupportedException = IcePy.defineException( - '::Ice::FeatureNotSupportedException', FeatureNotSupportedException, (), False, None, (('unsupportedFeature', (), IcePy._t_string, False, 0),)) + "::Ice::FeatureNotSupportedException", + FeatureNotSupportedException, + (), + False, + None, + (("unsupportedFeature", (), IcePy._t_string, False, 0),), + ) FeatureNotSupportedException._ice_type = _M_Ice._t_FeatureNotSupportedException _M_Ice.FeatureNotSupportedException = FeatureNotSupportedException del FeatureNotSupportedException -if 'SecurityException' not in _M_Ice.__dict__: +if "SecurityException" not in _M_Ice.__dict__: _M_Ice.SecurityException = Ice.createTempClass() class SecurityException(Ice.LocalException): @@ -1768,7 +2158,7 @@ class SecurityException(Ice.LocalException): reason -- The reason for the failure. """ - def __init__(self, reason=''): + def __init__(self, reason=""): self.reason = reason def __str__(self): @@ -1776,21 +2166,27 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::SecurityException' + _ice_id = "::Ice::SecurityException" _M_Ice._t_SecurityException = IcePy.defineException( - '::Ice::SecurityException', SecurityException, (), False, None, (('reason', (), IcePy._t_string, False, 0),)) + "::Ice::SecurityException", + SecurityException, + (), + False, + None, + (("reason", (), IcePy._t_string, False, 0),), + ) SecurityException._ice_type = _M_Ice._t_SecurityException _M_Ice.SecurityException = SecurityException del SecurityException -if 'FixedProxyException' not in _M_Ice.__dict__: +if "FixedProxyException" not in _M_Ice.__dict__: _M_Ice.FixedProxyException = Ice.createTempClass() class FixedProxyException(Ice.LocalException): """ - This exception indicates that an attempt has been made to change the connection properties of a fixed proxy. + This exception indicates that an attempt has been made to change the connection properties of a fixed proxy. """ def __init__(self): @@ -1801,21 +2197,22 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::FixedProxyException' + _ice_id = "::Ice::FixedProxyException" _M_Ice._t_FixedProxyException = IcePy.defineException( - '::Ice::FixedProxyException', FixedProxyException, (), False, None, ()) + "::Ice::FixedProxyException", FixedProxyException, (), False, None, () + ) FixedProxyException._ice_type = _M_Ice._t_FixedProxyException _M_Ice.FixedProxyException = FixedProxyException del FixedProxyException -if 'ResponseSentException' not in _M_Ice.__dict__: +if "ResponseSentException" not in _M_Ice.__dict__: _M_Ice.ResponseSentException = Ice.createTempClass() class ResponseSentException(Ice.LocalException): """ - Indicates that the response to a request has already been sent; re-dispatching such a request is not possible. + Indicates that the response to a request has already been sent; re-dispatching such a request is not possible. """ def __init__(self): @@ -1826,10 +2223,11 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::Ice::ResponseSentException' + _ice_id = "::Ice::ResponseSentException" _M_Ice._t_ResponseSentException = IcePy.defineException( - '::Ice::ResponseSentException', ResponseSentException, (), False, None, ()) + "::Ice::ResponseSentException", ResponseSentException, (), False, None, () + ) ResponseSentException._ice_type = _M_Ice._t_ResponseSentException _M_Ice.ResponseSentException = ResponseSentException diff --git a/python/python/Ice/LoggerF_local.py b/python/python/Ice/LoggerF_local.py index baeff98b517..eb07e7b9c6e 100644 --- a/python/python/Ice/LoggerF_local.py +++ b/python/python/Ice/LoggerF_local.py @@ -18,10 +18,10 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'Logger' not in _M_Ice.__dict__: - _M_Ice._t_Logger = IcePy.declareValue('::Ice::Logger') +if "Logger" not in _M_Ice.__dict__: + _M_Ice._t_Logger = IcePy.declareValue("::Ice::Logger") # End of module Ice diff --git a/python/python/Ice/Logger_local.py b/python/python/Ice/Logger_local.py index 39e09d1f135..330b40b1d2c 100644 --- a/python/python/Ice/Logger_local.py +++ b/python/python/Ice/Logger_local.py @@ -18,21 +18,21 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'Logger' not in _M_Ice.__dict__: +if "Logger" not in _M_Ice.__dict__: _M_Ice.Logger = Ice.createTempClass() class Logger(object): """ - The Ice message logger. Applications can provide their own logger by implementing this interface and installing it - in a communicator. + The Ice message logger. Applications can provide their own logger by implementing this interface and installing it + in a communicator. """ def __init__(self): if Ice.getType(self) == _M_Ice.Logger: - raise RuntimeError('Ice.Logger is an abstract class') + raise RuntimeError("Ice.Logger is an abstract class") def _print(self, message): """ @@ -89,7 +89,9 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Logger = IcePy.defineValue('::Ice::Logger', Logger, -1, (), False, True, None, ()) + _M_Ice._t_Logger = IcePy.defineValue( + "::Ice::Logger", Logger, -1, (), False, True, None, () + ) Logger._ice_type = _M_Ice._t_Logger _M_Ice.Logger = Logger diff --git a/python/python/Ice/ObjectAdapterF_local.py b/python/python/Ice/ObjectAdapterF_local.py index a6604c74d0d..2e66bac8605 100644 --- a/python/python/Ice/ObjectAdapterF_local.py +++ b/python/python/Ice/ObjectAdapterF_local.py @@ -18,10 +18,10 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'ObjectAdapter' not in _M_Ice.__dict__: - _M_Ice._t_ObjectAdapter = IcePy.declareValue('::Ice::ObjectAdapter') +if "ObjectAdapter" not in _M_Ice.__dict__: + _M_Ice._t_ObjectAdapter = IcePy.declareValue("::Ice::ObjectAdapter") # End of module Ice diff --git a/python/python/Ice/ObjectAdapter_local.py b/python/python/Ice/ObjectAdapter_local.py index 85444741613..485a1cf43f4 100644 --- a/python/python/Ice/ObjectAdapter_local.py +++ b/python/python/Ice/ObjectAdapter_local.py @@ -23,24 +23,24 @@ import Ice.Endpoint_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'ObjectAdapter' not in _M_Ice.__dict__: +if "ObjectAdapter" not in _M_Ice.__dict__: _M_Ice.ObjectAdapter = Ice.createTempClass() class ObjectAdapter(object): """ - The object adapter provides an up-call interface from the Ice run time to the implementation of Ice objects. The - object adapter is responsible for receiving requests from endpoints, and for mapping between servants, identities, - and proxies. + The object adapter provides an up-call interface from the Ice run time to the implementation of Ice objects. The + object adapter is responsible for receiving requests from endpoints, and for mapping between servants, identities, + and proxies. """ def __init__(self): if Ice.getType(self) == _M_Ice.ObjectAdapter: - raise RuntimeError('Ice.ObjectAdapter is an abstract class') + raise RuntimeError("Ice.ObjectAdapter is an abstract class") def getName(self): """ @@ -58,45 +58,45 @@ def getCommunicator(self): def activate(self): """ - Activate all endpoints that belong to this object adapter. After activation, the object adapter can dispatch - requests received through its endpoints. + Activate all endpoints that belong to this object adapter. After activation, the object adapter can dispatch + requests received through its endpoints. """ raise NotImplementedError("method 'activate' not implemented") def hold(self): """ - Temporarily hold receiving and dispatching requests. The object adapter can be reactivated with the - activate operation. Holding is not immediate, i.e., after hold returns, the - object adapter might still be active for some time. You can use waitForHold to wait until holding is - complete. + Temporarily hold receiving and dispatching requests. The object adapter can be reactivated with the + activate operation. Holding is not immediate, i.e., after hold returns, the + object adapter might still be active for some time. You can use waitForHold to wait until holding is + complete. """ raise NotImplementedError("method 'hold' not implemented") def waitForHold(self): """ - Wait until the object adapter holds requests. Calling hold initiates holding of requests, and - waitForHold only returns when holding of requests has been completed. + Wait until the object adapter holds requests. Calling hold initiates holding of requests, and + waitForHold only returns when holding of requests has been completed. """ raise NotImplementedError("method 'waitForHold' not implemented") def deactivate(self): """ - Deactivate all endpoints that belong to this object adapter. After deactivation, the object adapter stops - receiving requests through its endpoints. Object adapters that have been deactivated must not be reactivated - again, and cannot be used otherwise. Attempts to use a deactivated object adapter raise - ObjectAdapterDeactivatedException however, attempts to deactivate an already deactivated - object adapter are ignored and do nothing. Once deactivated, it is possible to destroy the adapter to clean up - resources and then create and activate a new adapter with the same name. - After deactivate returns, no new requests are processed by the object adapter. - However, requests that have been started before deactivate was called might still be active. You can - use waitForDeactivate to wait for the completion of all requests for this object adapter. + Deactivate all endpoints that belong to this object adapter. After deactivation, the object adapter stops + receiving requests through its endpoints. Object adapters that have been deactivated must not be reactivated + again, and cannot be used otherwise. Attempts to use a deactivated object adapter raise + ObjectAdapterDeactivatedException however, attempts to deactivate an already deactivated + object adapter are ignored and do nothing. Once deactivated, it is possible to destroy the adapter to clean up + resources and then create and activate a new adapter with the same name. + After deactivate returns, no new requests are processed by the object adapter. + However, requests that have been started before deactivate was called might still be active. You can + use waitForDeactivate to wait for the completion of all requests for this object adapter. """ raise NotImplementedError("method 'deactivate' not implemented") def waitForDeactivate(self): """ - Wait until the object adapter has deactivated. Calling deactivate initiates object adapter - deactivation, and waitForDeactivate only returns when deactivation has been completed. + Wait until the object adapter has deactivated. Calling deactivate initiates object adapter + deactivation, and waitForDeactivate only returns when deactivation has been completed. """ raise NotImplementedError("method 'waitForDeactivate' not implemented") @@ -109,10 +109,10 @@ def isDeactivated(self): def destroy(self): """ - Destroys the object adapter and cleans up all resources held by the object adapter. If the object adapter has - not yet been deactivated, destroy implicitly initiates the deactivation and waits for it to finish. Subsequent - calls to destroy are ignored. Once destroy has returned, it is possible to create another object adapter with - the same name. + Destroys the object adapter and cleans up all resources held by the object adapter. If the object adapter has + not yet been deactivated, destroy implicitly initiates the deactivation and waits for it to finish. Subsequent + calls to destroy are ignored. Once destroy has returned, it is possible to create another object adapter with + the same name. """ raise NotImplementedError("method 'destroy' not implemented") @@ -373,12 +373,14 @@ def getEndpoints(self): def refreshPublishedEndpoints(self): """ - Refresh the set of published endpoints. The run time re-reads the PublishedEndpoints property if it is set and - re-reads the list of local interfaces if the adapter is configured to listen on all endpoints. This operation - is useful to refresh the endpoint information that is published in the proxies that are created by an object - adapter if the network interfaces used by a host changes. + Refresh the set of published endpoints. The run time re-reads the PublishedEndpoints property if it is set and + re-reads the list of local interfaces if the adapter is configured to listen on all endpoints. This operation + is useful to refresh the endpoint information that is published in the proxies that are created by an object + adapter if the network interfaces used by a host changes. """ - raise NotImplementedError("method 'refreshPublishedEndpoints' not implemented") + raise NotImplementedError( + "method 'refreshPublishedEndpoints' not implemented" + ) def getPublishedEndpoints(self): """ @@ -400,7 +402,9 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_ObjectAdapter = IcePy.defineValue('::Ice::ObjectAdapter', ObjectAdapter, -1, (), False, True, None, ()) + _M_Ice._t_ObjectAdapter = IcePy.defineValue( + "::Ice::ObjectAdapter", ObjectAdapter, -1, (), False, True, None, () + ) ObjectAdapter._ice_type = _M_Ice._t_ObjectAdapter _M_Ice.ObjectAdapter = ObjectAdapter diff --git a/python/python/Ice/PluginF_local.py b/python/python/Ice/PluginF_local.py index c68aa8a230d..e78d6ffdeee 100644 --- a/python/python/Ice/PluginF_local.py +++ b/python/python/Ice/PluginF_local.py @@ -18,13 +18,13 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'Plugin' not in _M_Ice.__dict__: - _M_Ice._t_Plugin = IcePy.declareValue('::Ice::Plugin') +if "Plugin" not in _M_Ice.__dict__: + _M_Ice._t_Plugin = IcePy.declareValue("::Ice::Plugin") -if 'PluginManager' not in _M_Ice.__dict__: - _M_Ice._t_PluginManager = IcePy.declareValue('::Ice::PluginManager') +if "PluginManager" not in _M_Ice.__dict__: + _M_Ice._t_PluginManager = IcePy.declareValue("::Ice::PluginManager") # End of module Ice diff --git a/python/python/Ice/Plugin_local.py b/python/python/Ice/Plugin_local.py index 850a818e8a5..ad61cde8ae3 100644 --- a/python/python/Ice/Plugin_local.py +++ b/python/python/Ice/Plugin_local.py @@ -20,34 +20,34 @@ import Ice.BuiltinSequences_ice # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'Plugin' not in _M_Ice.__dict__: +if "Plugin" not in _M_Ice.__dict__: _M_Ice.Plugin = Ice.createTempClass() class Plugin(object): """ - A communicator plug-in. A plug-in generally adds a feature to a communicator, such as support for a protocol. - The communicator loads its plug-ins in two stages: the first stage creates the plug-ins, and the second stage - invokes Plugin#initialize on each one. + A communicator plug-in. A plug-in generally adds a feature to a communicator, such as support for a protocol. + The communicator loads its plug-ins in two stages: the first stage creates the plug-ins, and the second stage + invokes Plugin#initialize on each one. """ def __init__(self): if Ice.getType(self) == _M_Ice.Plugin: - raise RuntimeError('Ice.Plugin is an abstract class') + raise RuntimeError("Ice.Plugin is an abstract class") def initialize(self): """ - Perform any necessary initialization steps. + Perform any necessary initialization steps. """ raise NotImplementedError("method 'initialize' not implemented") def destroy(self): """ - Called when the communicator is being destroyed. + Called when the communicator is being destroyed. """ raise NotImplementedError("method 'destroy' not implemented") @@ -56,23 +56,25 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Plugin = IcePy.defineValue('::Ice::Plugin', Plugin, -1, (), False, True, None, ()) + _M_Ice._t_Plugin = IcePy.defineValue( + "::Ice::Plugin", Plugin, -1, (), False, True, None, () + ) Plugin._ice_type = _M_Ice._t_Plugin _M_Ice.Plugin = Plugin del Plugin -if 'PluginManager' not in _M_Ice.__dict__: +if "PluginManager" not in _M_Ice.__dict__: _M_Ice.PluginManager = Ice.createTempClass() class PluginManager(object): """ - Each communicator has a plug-in manager to administer the set of plug-ins. + Each communicator has a plug-in manager to administer the set of plug-ins. """ def __init__(self): if Ice.getType(self) == _M_Ice.PluginManager: - raise RuntimeError('Ice.PluginManager is an abstract class') + raise RuntimeError("Ice.PluginManager is an abstract class") def initializePlugins(self): """ @@ -117,7 +119,7 @@ def addPlugin(self, name, pi): def destroy(self): """ - Called when the communicator is being destroyed. + Called when the communicator is being destroyed. """ raise NotImplementedError("method 'destroy' not implemented") @@ -126,7 +128,9 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_PluginManager = IcePy.defineValue('::Ice::PluginManager', PluginManager, -1, (), False, True, None, ()) + _M_Ice._t_PluginManager = IcePy.defineValue( + "::Ice::PluginManager", PluginManager, -1, (), False, True, None, () + ) PluginManager._ice_type = _M_Ice._t_PluginManager _M_Ice.PluginManager = PluginManager diff --git a/python/python/Ice/PropertiesF_local.py b/python/python/Ice/PropertiesF_local.py index f309ed89038..4c78a60475a 100644 --- a/python/python/Ice/PropertiesF_local.py +++ b/python/python/Ice/PropertiesF_local.py @@ -18,14 +18,14 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'Properties' not in _M_Ice.__dict__: - _M_Ice._t_Properties = IcePy.declareValue('::Ice::Properties') +if "Properties" not in _M_Ice.__dict__: + _M_Ice._t_Properties = IcePy.declareValue("::Ice::Properties") -if 'PropertiesAdmin' not in _M_Ice.__dict__: - _M_Ice._t_PropertiesAdminDisp = IcePy.declareClass('::Ice::PropertiesAdmin') - _M_Ice._t_PropertiesAdminPrx = IcePy.declareProxy('::Ice::PropertiesAdmin') +if "PropertiesAdmin" not in _M_Ice.__dict__: + _M_Ice._t_PropertiesAdminDisp = IcePy.declareClass("::Ice::PropertiesAdmin") + _M_Ice._t_PropertiesAdminPrx = IcePy.declareProxy("::Ice::PropertiesAdmin") # End of module Ice diff --git a/python/python/Ice/Properties_local.py b/python/python/Ice/Properties_local.py index 2a0c709e482..7f0c8380270 100644 --- a/python/python/Ice/Properties_local.py +++ b/python/python/Ice/Properties_local.py @@ -20,24 +20,24 @@ import Ice.PropertyDict_ice # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'Properties' not in _M_Ice.__dict__: +if "Properties" not in _M_Ice.__dict__: _M_Ice.Properties = Ice.createTempClass() class Properties(object): """ - A property set used to configure Ice and Ice applications. Properties are key/value pairs, with both keys and - values being strings. By convention, property keys should have the form - application-name[.category[.sub-category]].name. + A property set used to configure Ice and Ice applications. Properties are key/value pairs, with both keys and + values being strings. By convention, property keys should have the form + application-name[.category[.sub-category]].name. """ def __init__(self): if Ice.getType(self) == _M_Ice.Properties: - raise RuntimeError('Ice.Properties is an abstract class') + raise RuntimeError("Ice.Properties is an abstract class") def getProperty(self, key): """ @@ -75,7 +75,9 @@ def getPropertyAsIntWithDefault(self, key, value): value -- The default value to use if the property does not exist. Returns: The property value interpreted as an integer, or the default value. """ - raise NotImplementedError("method 'getPropertyAsIntWithDefault' not implemented") + raise NotImplementedError( + "method 'getPropertyAsIntWithDefault' not implemented" + ) def getPropertyAsList(self, key): """ @@ -102,7 +104,9 @@ def getPropertyAsListWithDefault(self, key, value): value -- The default value to use if the property is not set. Returns: The property value interpreted as list of strings, or the default value. """ - raise NotImplementedError("method 'getPropertyAsListWithDefault' not implemented") + raise NotImplementedError( + "method 'getPropertyAsListWithDefault' not implemented" + ) def getPropertiesForPrefix(self, prefix): """ @@ -141,7 +145,9 @@ def parseCommandLineOptions(self, prefix, options): options -- The command-line options. Returns: The command-line options that do not start with the specified prefix, in their original order. """ - raise NotImplementedError("method 'parseCommandLineOptions' not implemented") + raise NotImplementedError( + "method 'parseCommandLineOptions' not implemented" + ) def parseIceCommandLineOptions(self, options): """ @@ -152,7 +158,9 @@ def parseIceCommandLineOptions(self, options): options -- The command-line options. Returns: The command-line options that do not start with one of the listed prefixes, in their original order. """ - raise NotImplementedError("method 'parseIceCommandLineOptions' not implemented") + raise NotImplementedError( + "method 'parseIceCommandLineOptions' not implemented" + ) def load(self, file): """ @@ -174,7 +182,9 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_Properties = IcePy.defineValue('::Ice::Properties', Properties, -1, (), False, True, None, ()) + _M_Ice._t_Properties = IcePy.defineValue( + "::Ice::Properties", Properties, -1, (), False, True, None, () + ) Properties._ice_type = _M_Ice._t_Properties _M_Ice.Properties = Properties diff --git a/python/python/Ice/ServantLocatorF_local.py b/python/python/Ice/ServantLocatorF_local.py index 2ccffacf5d3..1a7687aefb8 100644 --- a/python/python/Ice/ServantLocatorF_local.py +++ b/python/python/Ice/ServantLocatorF_local.py @@ -18,10 +18,10 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'ServantLocator' not in _M_Ice.__dict__: - _M_Ice._t_ServantLocator = IcePy.declareValue('::Ice::ServantLocator') +if "ServantLocator" not in _M_Ice.__dict__: + _M_Ice._t_ServantLocator = IcePy.declareValue("::Ice::ServantLocator") # End of module Ice diff --git a/python/python/Ice/ServantLocator_local.py b/python/python/Ice/ServantLocator_local.py index 31ad8bf4581..c928ef32a49 100644 --- a/python/python/Ice/ServantLocator_local.py +++ b/python/python/Ice/ServantLocator_local.py @@ -20,22 +20,22 @@ import Ice.Current_local # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module Ice -__name__ = 'Ice' +__name__ = "Ice" -if 'ServantLocator' not in _M_Ice.__dict__: +if "ServantLocator" not in _M_Ice.__dict__: _M_Ice.ServantLocator = Ice.createTempClass() class ServantLocator(object): """ - A servant locator is called by an object adapter to locate a servant that is not found in its active servant map. + A servant locator is called by an object adapter to locate a servant that is not found in its active servant map. """ def __init__(self): if Ice.getType(self) == _M_Ice.ServantLocator: - raise RuntimeError('Ice.ServantLocator is an abstract class') + raise RuntimeError("Ice.ServantLocator is an abstract class") def locate(self, curr): """ @@ -91,7 +91,9 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_ServantLocator = IcePy.defineValue('::Ice::ServantLocator', ServantLocator, -1, (), False, True, None, ()) + _M_Ice._t_ServantLocator = IcePy.defineValue( + "::Ice::ServantLocator", ServantLocator, -1, (), False, True, None, () + ) ServantLocator._ice_type = _M_Ice._t_ServantLocator _M_Ice.ServantLocator = ServantLocator diff --git a/python/python/Ice/ValueFactory_local.py b/python/python/Ice/ValueFactory_local.py index b030bb61754..cdb788ccb55 100644 --- a/python/python/Ice/ValueFactory_local.py +++ b/python/python/Ice/ValueFactory_local.py @@ -18,22 +18,22 @@ import IcePy # Start of module Ice -_M_Ice = Ice.openModule('Ice') -__name__ = 'Ice' +_M_Ice = Ice.openModule("Ice") +__name__ = "Ice" -if 'ValueFactory' not in _M_Ice.__dict__: +if "ValueFactory" not in _M_Ice.__dict__: _M_Ice.ValueFactory = Ice.createTempClass() class ValueFactory(object): """ - A factory for values. Value factories are used in several places, such as when Ice receives a class instance and - when Freeze restores a persistent value. Value factories must be implemented by the application writer and - registered with the communicator. + A factory for values. Value factories are used in several places, such as when Ice receives a class instance and + when Freeze restores a persistent value. Value factories must be implemented by the application writer and + registered with the communicator. """ def __init__(self): if Ice.getType(self) == _M_Ice.ValueFactory: - raise RuntimeError('Ice.ValueFactory is an abstract class') + raise RuntimeError("Ice.ValueFactory is an abstract class") def create(self, type): """ @@ -52,24 +52,26 @@ def __str__(self): __repr__ = __str__ - _M_Ice._t_ValueFactory = IcePy.defineValue('::Ice::ValueFactory', ValueFactory, -1, (), False, True, None, ()) + _M_Ice._t_ValueFactory = IcePy.defineValue( + "::Ice::ValueFactory", ValueFactory, -1, (), False, True, None, () + ) ValueFactory._ice_type = _M_Ice._t_ValueFactory _M_Ice.ValueFactory = ValueFactory del ValueFactory -if 'ValueFactoryManager' not in _M_Ice.__dict__: +if "ValueFactoryManager" not in _M_Ice.__dict__: _M_Ice.ValueFactoryManager = Ice.createTempClass() class ValueFactoryManager(object): """ - A value factory manager maintains a collection of value factories. An application can supply a custom - implementation during communicator initialization, otherwise Ice provides a default implementation. + A value factory manager maintains a collection of value factories. An application can supply a custom + implementation during communicator initialization, otherwise Ice provides a default implementation. """ def __init__(self): if Ice.getType(self) == _M_Ice.ValueFactoryManager: - raise RuntimeError('Ice.ValueFactoryManager is an abstract class') + raise RuntimeError("Ice.ValueFactoryManager is an abstract class") def add(self, factory, id): """ @@ -110,7 +112,8 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ValueFactoryManager = IcePy.defineValue( - '::Ice::ValueFactoryManager', ValueFactoryManager, -1, (), False, True, None, ()) + "::Ice::ValueFactoryManager", ValueFactoryManager, -1, (), False, True, None, () + ) ValueFactoryManager._ice_type = _M_Ice._t_ValueFactoryManager _M_Ice.ValueFactoryManager = ValueFactoryManager diff --git a/python/python/Ice/__init__.py b/python/python/Ice/__init__.py index 192a1d89e94..f6ad058c69f 100644 --- a/python/python/Ice/__init__.py +++ b/python/python/Ice/__init__.py @@ -2,15 +2,15 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # +# ruff: noqa: F401, F821 + """ Ice module """ import sys -import string import os import threading -import warnings import datetime import logging import time @@ -31,6 +31,7 @@ try: import dl + sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL) except ImportError: # @@ -62,6 +63,7 @@ # Give the extension an opportunity to clean up before a graceful exit. # import atexit + atexit.register(IcePy.cleanup) # @@ -82,7 +84,7 @@ AsyncResult = IcePy.AsyncResult Unset = IcePy.Unset -from Ice.IceFuture import FutureBase, wrap_future +from Ice.IceFuture import FutureBase, wrap_future # noqa class Future(FutureBase): @@ -190,7 +192,7 @@ def _wait(self, timeout, testFn=None): start = time.time() self._condition.wait(timeout) # Subtract the elapsed time so far from the timeout - timeout -= (time.time() - start) + timeout -= time.time() - start if timeout <= 0: return False else: @@ -202,21 +204,21 @@ def _callCallbacks(self, callbacks): for callback in callbacks: try: callback(self) - except: - self._warn('done callback raised exception') + except Exception: + self._warn("done callback raised exception") def _warn(self, msg): logging.getLogger("Ice.Future").exception(msg) - StateRunning = 'running' - StateCancelled = 'cancelled' - StateDone = 'done' + StateRunning = "running" + StateCancelled = "cancelled" + StateDone = "done" class InvocationFuture(Future): def __init__(self, operation, asyncResult): Future.__init__(self) - assert (asyncResult) + assert asyncResult self._operation = operation self._asyncResult = asyncResult # May be None for a batch invocation. self._sent = False @@ -231,8 +233,8 @@ def add_done_callback_async(self, fn): def callback(): try: fn(self) - except: - self._warn('done callback raised exception') + except Exception: + self._warn("done callback raised exception") with self._condition: if self._state == Future.StateRunning: @@ -259,8 +261,8 @@ def add_sent_callback_async(self, fn): def callback(): try: fn(self, self._sentSynchronously) - except: - self._warn('sent callback raised exception') + except Exception: + self._warn("sent callback raised exception") with self._condition: if not self._sent: @@ -295,7 +297,7 @@ def set_sent(self, sentSynchronously): try: callback(self, sentSynchronously) except Exception: - self._warn('sent callback raised exception') + self._warn("sent callback raised exception") def operation(self): return self._operation @@ -312,8 +314,15 @@ def communicator(self): def _warn(self, msg): communicator = self.communicator() if communicator: - if communicator.getProperties().getPropertyAsIntWithDefault("Ice.Warn.AMICallback", 1) > 0: - communicator.getLogger().warning("Ice.Future: " + msg + ":\n" + traceback.format_exc()) + if ( + communicator.getProperties().getPropertyAsIntWithDefault( + "Ice.Warn.AMICallback", 1 + ) + > 0 + ): + communicator.getLogger().warning( + "Ice.Future: " + msg + ":\n" + traceback.format_exc() + ) else: logging.getLogger("Ice.Future").exception(msg) @@ -331,22 +340,19 @@ def _warn(self, msg): class Value(object): - def ice_id(self): - '''Obtains the type id corresponding to the most-derived Slice -interface supported by the target object. -Returns: - The type id. -''' - return '::Ice::Object' + """Obtains the type id corresponding to the most-derived Slice + interface supported by the target object. + Returns: + The type id.""" + return "::Ice::Object" @staticmethod def ice_staticId(): - '''Obtains the type id of this Slice class or interface. -Returns: - The type id. -''' - return '::Ice::Object' + """Obtains the type id of this Slice class or interface. + Returns: + The type id.""" + return "::Ice::Object" # # Do not define these here. They will be invoked if defined by a subclass. @@ -358,16 +364,14 @@ def ice_staticId(): # pass def ice_getSlicedData(self): - '''Returns the sliced data if the value has a preserved-slice base class and has been sliced during -un-marshaling of the value, null is returned otherwise. -Returns: - The sliced data or null. -''' + """Returns the sliced data if the value has a preserved-slice base class and has been sliced during + un-marshaling of the value, null is returned otherwise. + Returns: + The sliced data or null.""" return getattr(self, "_ice_slicedData", None) class InterfaceByValue(Value): - def __init__(self, id): self.id = id @@ -376,56 +380,55 @@ def ice_id(self): class Object(object): - def ice_isA(self, id, current=None): - '''Determines whether the target object supports the interface denoted -by the given Slice type id. -Arguments: - id The Slice type id -Returns: - True if the target object supports the interface, or False otherwise. -''' + """Determines whether the target object supports the interface denoted + by the given Slice type id. + Arguments: + id The Slice type id + Returns: + True if the target object supports the interface, or False otherwise.""" return id in self.ice_ids(current) def ice_ping(self, current=None): - '''A reachability test for the target object.''' + """A reachability test for the target object.""" pass def ice_ids(self, current=None): - '''Obtains the type ids corresponding to the Slice interface -that are supported by the target object. -Returns: - A list of type ids. -''' + """Obtains the type ids corresponding to the Slice interface + that are supported by the target object. + Returns: + A list of type ids.""" return [self.ice_id(current)] def ice_id(self, current=None): - '''Obtains the type id corresponding to the most-derived Slice -interface supported by the target object. -Returns: - The type id. -''' - return '::Ice::Object' + """Obtains the type id corresponding to the most-derived Slice + interface supported by the target object. + Returns: + The type id.""" + return "::Ice::Object" @staticmethod def ice_staticId(): - '''Obtains the type id of this Slice class or interface. -Returns: - The type id. -''' - return '::Ice::Object' + """Obtains the type id of this Slice class or interface. + Returns: + The type id.""" + return "::Ice::Object" def _iceDispatch(self, cb, method, args): # Invoke the given servant method. Exceptions can propagate to the caller. result = method(*args) # Check for a future. - if isinstance(result, Future) or callable(getattr(result, "add_done_callback", None)): + if isinstance(result, Future) or callable( + getattr(result, "add_done_callback", None) + ): + def handler(future): try: cb.response(future.result()) - except: + except Exception: cb.exception(sys.exc_info()[1]) + result.add_done_callback(handler) elif inspect.iscoroutine(result): self._iceDispatchCoroutine(cb, result) @@ -442,92 +445,99 @@ def _iceDispatchCoroutine(self, cb, coro, value=None, exception=None): if result is None: # The result can be None if the coroutine performs a bare yield (such as asyncio.sleep(0)) cb.response(None) - elif isinstance(result, Future) or callable(getattr(result, "add_done_callback", None)): + elif isinstance(result, Future) or callable( + getattr(result, "add_done_callback", None) + ): # If we've received a future from the coroutine setup a done callback to continue the dispatching # when the future completes. def handler(future): try: self._iceDispatchCoroutine(cb, coro, value=future.result()) - except: - self._iceDispatchCoroutine(cb, coro, exception=sys.exc_info()[1]) + except BaseException: + self._iceDispatchCoroutine( + cb, coro, exception=sys.exc_info()[1] + ) + result.add_done_callback(handler) else: - raise RuntimeError('unexpected value of type ' + str(type(result)) + ' provided by coroutine') + raise RuntimeError( + "unexpected value of type " + + str(type(result)) + + " provided by coroutine" + ) except StopIteration as ex: # StopIteration is raised when the coroutine completes. cb.response(ex.value) - except: + except BaseException: cb.exception(sys.exc_info()[1]) class Blobject(Object): - '''Special-purpose servant base class that allows a subclass to -handle synchronous Ice invocations as "blobs" of bytes.''' + """Special-purpose servant base class that allows a subclass to + handle synchronous Ice invocations as "blobs" of bytes.""" def ice_invoke(self, bytes, current): - '''Dispatch a synchronous Ice invocation. The operation's -arguments are encoded in the bytes argument. The return -value must be a tuple of two values: the first is a -boolean indicating whether the operation succeeded (True) -or raised a user exception (False), and the second is -the encoded form of the operation's results or the user -exception. -''' + """Dispatch a synchronous Ice invocation. The operation's + arguments are encoded in the bytes argument. The return + value must be a tuple of two values: the first is a + boolean indicating whether the operation succeeded (True) + or raised a user exception (False), and the second is + the encoded form of the operation's results or the user + exception.""" pass class BlobjectAsync(Object): - '''Special-purpose servant base class that allows a subclass to -handle asynchronous Ice invocations as "blobs" of bytes.''' + """Special-purpose servant base class that allows a subclass to + handle asynchronous Ice invocations as "blobs" of bytes.""" def ice_invoke(self, bytes, current): - '''Dispatch an asynchronous Ice invocation. The operation's -arguments are encoded in the bytes argument. The result must be -a tuple of two values: the first is a boolean indicating whether the -operation succeeded (True) or raised a user exception (False), and -the second is the encoded form of the operation's results or the user -exception. The subclass can either return the tuple directly (for -synchronous completion) or return a future that is eventually -completed with the tuple. -''' + """Dispatch an asynchronous Ice invocation. The operation's + arguments are encoded in the bytes argument. The result must be + a tuple of two values: the first is a boolean indicating whether the + operation succeeded (True) or raised a user exception (False), and + the second is the encoded form of the operation's results or the user + exception. The subclass can either return the tuple directly (for + synchronous completion) or return a future that is eventually + completed with the tuple.""" pass + # # Exceptions. # -class Exception(Exception): # Derives from built-in base 'Exception' class. - '''The base class for all Ice exceptions.''' +class Exception(Exception): # Derives from built-in base 'Exception' class. + """The base class for all Ice exceptions.""" def __str__(self): return self.__class__.__name__ def ice_name(self): - '''Returns the type name of this exception.''' + """Returns the type name of this exception.""" return self.ice_id()[2:] def ice_id(self): - '''Returns the type id of this exception.''' + """Returns the type id of this exception.""" return self._ice_id class LocalException(Exception): - '''The base class for all Ice run-time exceptions.''' + """The base class for all Ice run-time exceptions.""" - def __init__(self, args=''): + def __init__(self, args=""): self.args = args class UserException(Exception): - '''The base class for all user-defined exceptions.''' + """The base class for all user-defined exceptions.""" def ice_getSlicedData(self): - '''Returns the sliced data if the value has a preserved-slice base class and has been sliced during -un-marshaling of the value, null is returned otherwise. -Returns: - The sliced data or null. -''' + """Returns the sliced data if the value has a preserved-slice base class and has been sliced during + un-marshaling of the value, null is returned otherwise. + Returns: + The sliced data or null.""" return getattr(self, "_ice_slicedData", None) @@ -547,7 +557,7 @@ def __hash__(self): def __lt__(self, other): if isinstance(other, self.__class__): return self._value < other._value - elif other == None: + elif other is None: return False return NotImplemented @@ -561,28 +571,28 @@ def __le__(self, other): def __eq__(self, other): if isinstance(other, self.__class__): return self._value == other._value - elif other == None: + elif other is None: return False return NotImplemented def __ne__(self, other): if isinstance(other, self.__class__): return self._value != other._value - elif other == None: + elif other is None: return False return NotImplemented def __gt__(self, other): if isinstance(other, self.__class__): return self._value > other._value - elif other == None: + elif other is None: return False return NotImplemented def __ge__(self, other): if isinstance(other, self.__class__): return self._value >= other._value - elif other == None: + elif other is None: return False return NotImplemented @@ -625,8 +635,8 @@ class SliceInfo(object): class PropertiesAdminUpdateCallback(object): - '''Callback class to get notifications of property updates passed - through the Properties admin facet''' + """Callback class to get notifications of property updates passed + through the Properties admin facet""" def updated(self, props): pass @@ -643,7 +653,7 @@ def ice_id(self): def getSliceDir(): - '''Convenience function for locating the directory containing the Slice files.''' + """Convenience function for locating the directory containing the Slice files.""" # # Get the parent of the directory containing this file (__init__.py). @@ -693,6 +703,7 @@ def getSliceDir(): return None + # # Utilities for use by generated code. # @@ -715,11 +726,11 @@ def openModule(name): def createModule(name): global _pendingModules - l = name.split(".") - curr = '' + parts = name.split(".") + curr = "" mod = None - for s in l: + for s in parts: curr = curr + s if curr in sys.modules: @@ -758,12 +769,13 @@ def updateModules(): def createTempClass(): class __temp: pass + return __temp class FormatType(object): def __init__(self, val): - assert (val >= 0 and val < 3) + assert val >= 0 and val < 3 self.value = val @@ -774,10 +786,10 @@ def __init__(self, val): # # Forward declarations. # -IcePy._t_Object = IcePy.declareClass('::Ice::Object') -IcePy._t_Value = IcePy.declareValue('::Ice::Object') -IcePy._t_ObjectPrx = IcePy.declareProxy('::Ice::Object') -IcePy._t_LocalObject = IcePy.declareValue('::Ice::LocalObject') +IcePy._t_Object = IcePy.declareClass("::Ice::Object") +IcePy._t_Value = IcePy.declareValue("::Ice::Object") +IcePy._t_ObjectPrx = IcePy.declareProxy("::Ice::Object") +IcePy._t_LocalObject = IcePy.declareValue("::Ice::LocalObject") # # Import "local slice" and generated Ice modules. @@ -842,63 +854,63 @@ def __init__(self, val): class ThreadNotification(object): - '''Base class for thread notification callbacks. A subclass must -define the start and stop methods.''' + """Base class for thread notification callbacks. A subclass must + define the start and stop methods.""" def __init__(self): pass def start(): - '''Invoked in the context of a thread created by the Ice run time.''' + """Invoked in the context of a thread created by the Ice run time.""" pass def stop(): - '''Invoked in the context of an Ice run-time thread that is about -to terminate.''' + """Invoked in the context of an Ice run-time thread that is about + to terminate.""" pass class BatchRequestInterceptor(object): - '''Base class for batch request interceptor. A subclass must -define the enqueue method.''' + """Base class for batch request interceptor. A subclass must + define the enqueue method.""" def __init__(self): pass def enqueue(self, request, queueCount, queueSize): - '''Invoked when a request is batched.''' + """Invoked when a request is batched.""" pass + # # Initialization data. # class InitializationData(object): - '''The attributes of this class are used to initialize a new -communicator instance. The supported attributes are as follows: + """The attributes of this class are used to initialize a new + communicator instance. The supported attributes are as follows: -properties: An instance of Ice.Properties. You can use the - Ice.createProperties function to create a new property set. + properties: An instance of Ice.Properties. You can use the + Ice.createProperties function to create a new property set. -logger: An instance of Ice.Logger. + logger: An instance of Ice.Logger. -threadStart: A callable that is invoked for each new Ice thread that is started. + threadStart: A callable that is invoked for each new Ice thread that is started. -threadStop: A callable that is invoked when an Ice thread is stopped. + threadStop: A callable that is invoked when an Ice thread is stopped. -dispatcher: A callable that is invoked when Ice needs to dispatch an activity. The callable - receives two arguments: a callable and an Ice.Connection object. The dispatcher must - eventually invoke the callable with no arguments. + dispatcher: A callable that is invoked when Ice needs to dispatch an activity. The callable + receives two arguments: a callable and an Ice.Connection object. The dispatcher must + eventually invoke the callable with no arguments. -batchRequestInterceptor: A callable that will be invoked when a batch request is queued. - The callable receives three arguments: a BatchRequest object, an integer representing - the number of requests in the queue, and an integer representing the number of bytes - consumed by the requests in the queue. The interceptor must eventually invoke the - enqueue method on the BatchRequest object. + batchRequestInterceptor: A callable that will be invoked when a batch request is queued. + The callable receives three arguments: a BatchRequest object, an integer representing + the number of requests in the queue, and an integer representing the number of bytes + consumed by the requests in the queue. The interceptor must eventually invoke the + enqueue method on the BatchRequest object. -valueFactoryManager: An object that implements ValueFactoryManager. -''' + valueFactoryManager: An object that implements ValueFactoryManager.""" def __init__(self): self.properties = None @@ -910,6 +922,7 @@ def __init__(self): self.batchRequestInterceptor = None self.valueFactoryManager = None + # # Communicator wrapper. # @@ -982,7 +995,7 @@ def getValueFactoryManager(self): def getImplicitContext(self): context = self._impl.getImplicitContext() - if context == None: + if context is None: return None else: return ImplicitContextI(context) @@ -1040,27 +1053,28 @@ def findAllAdminFacets(self): def removeAdminFacet(self, facet): return self._impl.removeAdminFacet(facet) + # # Ice.initialize() # def initialize(args=None, data=None): - '''Initializes a new communicator. The optional arguments represent -an argument list (such as sys.argv) and an instance of InitializationData. -You can invoke this function as follows: - -Ice.initialize() -Ice.initialize(args) -Ice.initialize(data) -Ice.initialize(args, data) - -If you supply an argument list, the function removes those arguments from -the list that were recognized by the Ice run time. -''' + """Initializes a new communicator. The optional arguments represent + an argument list (such as sys.argv) and an instance of InitializationData. + You can invoke this function as follows: + + Ice.initialize() + Ice.initialize(args) + Ice.initialize(data) + Ice.initialize(args, data) + + If you supply an argument list, the function removes those arguments from + the list that were recognized by the Ice run time.""" communicator = IcePy.Communicator(args, data) return CommunicatorI(communicator) + # # Ice.identityToString # @@ -1069,6 +1083,7 @@ def initialize(args=None, data=None): def identityToString(id, toStringMode=None): return IcePy.identityToString(id, toStringMode) + # # Ice.stringToIdentity # @@ -1077,6 +1092,7 @@ def identityToString(id, toStringMode=None): def stringToIdentity(str): return IcePy.stringToIdentity(str) + # # ObjectAdapter wrapper. # @@ -1207,6 +1223,7 @@ def getPublishedEndpoints(self): def setPublishedEndpoints(self, newEndpoints): self._impl.setPublishedEndpoints(newEndpoints) + # # Logger wrapper. # @@ -1235,6 +1252,7 @@ def cloneWithPrefix(self, prefix): logger = self._impl.cloneWithPrefix(prefix) return LoggerI(logger) + # # Properties wrapper. # @@ -1285,34 +1303,35 @@ def clone(self): return PropertiesI(properties) def __iter__(self): - dict = self._impl.getPropertiesForPrefix('') + dict = self._impl.getPropertiesForPrefix("") return iter(dict) def __str__(self): return str(self._impl) + # # Ice.createProperties() # def createProperties(args=None, defaults=None): - '''Creates a new property set. The optional arguments represent -an argument list (such as sys.argv) and a property set that supplies -default values. You can invoke this function as follows: + """Creates a new property set. The optional arguments represent + an argument list (such as sys.argv) and a property set that supplies + default values. You can invoke this function as follows: -Ice.createProperties() -Ice.createProperties(args) -Ice.createProperties(defaults) -Ice.createProperties(args, defaults) + Ice.createProperties() + Ice.createProperties(args) + Ice.createProperties(defaults) + Ice.createProperties(args, defaults) -If you supply an argument list, the function removes those arguments -from the list that were recognized by the Ice run time. -''' + If you supply an argument list, the function removes those arguments + from the list that were recognized by the Ice run time.""" properties = IcePy.createProperties(args, defaults) return PropertiesI(properties) + # # Ice.getProcessLogger() # Ice.setProcessLogger() @@ -1320,7 +1339,7 @@ def createProperties(args=None, defaults=None): def getProcessLogger(): - '''Returns the default logger object.''' + """Returns the default logger object.""" logger = IcePy.getProcessLogger() if isinstance(logger, Logger): return logger @@ -1329,9 +1348,10 @@ def getProcessLogger(): def setProcessLogger(logger): - '''Sets the default logger object.''' + """Sets the default logger object.""" IcePy.setProcessLogger(logger) + # # ImplicitContext wrapper # @@ -1359,6 +1379,7 @@ def put(self, key, value): def remove(self, key): return self._impl.remove(key) + # # Its not possible to block in a python signal handler since this # blocks the main thread from doing further work. As such we queue the @@ -1378,8 +1399,10 @@ class CtrlCHandler(threading.Thread): def __init__(self): threading.Thread.__init__(self) - if CtrlCHandler._self != None: - raise RuntimeError("Only a single instance of a CtrlCHandler can be instantiated.") + if CtrlCHandler._self is not None: + raise RuntimeError( + "Only a single instance of a CtrlCHandler can be instantiated." + ) CtrlCHandler._self = self # State variables. These are not class static variables. @@ -1391,9 +1414,9 @@ def __init__(self): # # Setup and install signal handlers # - if 'SIGHUP' in signal.__dict__: + if "SIGHUP" in signal.__dict__: signal.signal(signal.SIGHUP, CtrlCHandler.signalHandler) - if 'SIGBREAK' in signal.__dict__: + if "SIGBREAK" in signal.__dict__: signal.signal(signal.SIGBREAK, CtrlCHandler.signalHandler) signal.signal(signal.SIGINT, CtrlCHandler.signalHandler) signal.signal(signal.SIGTERM, CtrlCHandler.signalHandler) @@ -1428,9 +1451,9 @@ def destroy(self): # # Cleanup any state set by the CtrlCHandler. # - if 'SIGHUP' in signal.__dict__: + if "SIGHUP" in signal.__dict__: signal.signal(signal.SIGHUP, signal.SIG_DFL) - if 'SIGBREAK' in signal.__dict__: + if "SIGBREAK" in signal.__dict__: signal.signal(signal.SIGBREAK, signal.SIG_DFL) signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGTERM, signal.SIG_DFL) @@ -1456,8 +1479,10 @@ def signalHandler(self, sig, frame): self._self._queue.append([sig, self._self._callback]) self._self._condVar.notify() self._self._condVar.release() + signalHandler = classmethod(signalHandler) + # # Application logger. # @@ -1472,7 +1497,6 @@ def __init__(self, prefix): self._outputMutex = threading.Lock() def _print(self, message): - s = "[ " + str(datetime.datetime.now()) + " " + self._prefix self._outputMutex.acquire() sys.stderr.write(message + "\n") self._outputMutex.release() @@ -1491,12 +1515,26 @@ def trace(self, category, message): def warning(self, message): self._outputMutex.acquire() - sys.stderr.write(str(datetime.datetime.now()) + " " + self._prefix + "warning: " + message + "\n") + sys.stderr.write( + str(datetime.datetime.now()) + + " " + + self._prefix + + "warning: " + + message + + "\n" + ) self._outputMutex.release() def error(self, message): self._outputMutex.acquire() - sys.stderr.write(str(datetime.datetime.now()) + " " + self._prefix + "error: " + message + "\n") + sys.stderr.write( + str(datetime.datetime.now()) + + " " + + self._prefix + + "error: " + + message + + "\n" + ) self._outputMutex.release() @@ -1507,32 +1545,31 @@ def error(self, message): class Application(object): - '''Convenience class that initializes a communicator and reacts -gracefully to signals. An application must define a subclass -of this class and supply an implementation of the run method. -''' + """Convenience class that initializes a communicator and reacts + gracefully to signals. An application must define a subclass + of this class and supply an implementation of the run method.""" def __init__(self, signalPolicy=0): # HandleSignals=0 - '''The constructor accepts an optional argument indicating -whether to handle signals. The value should be either -Application.HandleSignals (the default) or -Application.NoSignalHandling. -''' + """The constructor accepts an optional argument indicating + whether to handle signals. The value should be either + Application.HandleSignals (the default) or + Application.NoSignalHandling.""" if type(self) == Application: raise RuntimeError("Ice.Application is an abstract class") Application._signalPolicy = signalPolicy def main(self, args, configFile=None, initData=None): - '''The main entry point for the Application class. The arguments -are an argument list (such as sys.argv), the name of an Ice -configuration file (optional), and an instance of -InitializationData (optional). This method does not return -until after the completion of the run method. The return -value is an integer representing the exit status. -''' + """The main entry point for the Application class. The arguments + are an argument list (such as sys.argv), the name of an Ice + configuration file (optional), and an instance of + InitializationData (optional). This method does not return + until after the completion of the run method. The return + value is an integer representing the exit status.""" if Application._communicator: - getProcessLogger().error(args[0] + ": only one instance of the Application class can be used") + getProcessLogger().error( + args[0] + ": only one instance of the Application class can be used" + ) return 1 # @@ -1544,7 +1581,7 @@ def main(self, args, configFile=None, initData=None): try: initData.properties = createProperties(None, initData.properties) initData.properties.load(configFile) - except: + except Exception: getProcessLogger().error(traceback.format_exc()) return 1 initData.properties = createProperties(args, initData.properties) @@ -1554,7 +1591,9 @@ def main(self, args, configFile=None, initData=None): # a logger which is using the program name for the prefix. # if isinstance(getProcessLogger(), LoggerI): - setProcessLogger(_ApplicationLoggerI(initData.properties.getProperty("Ice.ProgramName"))) + setProcessLogger( + _ApplicationLoggerI(initData.properties.getProperty("Ice.ProgramName")) + ) # # Install our handler for the signals we are interested in. We assume main() @@ -1565,7 +1604,9 @@ def main(self, args, configFile=None, initData=None): try: Application._interrupted = False - Application._appName = initData.properties.getPropertyWithDefault("Ice.ProgramName", args[0]) + Application._appName = initData.properties.getPropertyWithDefault( + "Ice.ProgramName", args[0] + ) Application._application = self # @@ -1580,7 +1621,7 @@ def main(self, args, configFile=None, initData=None): Application.destroyOnInterrupt() status = self.doMain(args, initData) - except: + except Exception: getProcessLogger().error(traceback.format_exc()) status = 1 # @@ -1599,7 +1640,7 @@ def doMain(self, args, initData): Application._destroyed = False status = self.run(args) - except: + except Exception: getProcessLogger().error(traceback.format_exc()) status = 1 @@ -1629,39 +1670,40 @@ def doMain(self, args, initData): if Application._communicator: try: Application._communicator.destroy() - except: + except Exception: getProcessLogger().error(traceback.format_exc()) status = 1 Application._communicator = None return status def run(self, args): - '''This method must be overridden in a subclass. The base -class supplies an argument list from which all Ice arguments -have already been removed. The method returns an integer -exit status (0 is success, non-zero is failure). -''' - raise RuntimeError('run() not implemented') + """This method must be overridden in a subclass. The base + class supplies an argument list from which all Ice arguments + have already been removed. The method returns an integer + exit status (0 is success, non-zero is failure).""" + raise RuntimeError("run() not implemented") def interruptCallback(self, sig): - '''Subclass hook to intercept an interrupt.''' + """Subclass hook to intercept an interrupt.""" pass def appName(self): - '''Returns the application name (the first element of -the argument list).''' + """Returns the application name (the first element of + the argument list).""" return self._appName + appName = classmethod(appName) def communicator(self): - '''Returns the communicator that was initialized for -the application.''' + """Returns the communicator that was initialized for + the application.""" return self._communicator + communicator = classmethod(communicator) def destroyOnInterrupt(self): - '''Configures the application to destroy its communicator -when interrupted by a signal.''' + """Configures the application to destroy its communicator + when interrupted by a signal.""" if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() == self._holdInterruptCallback: @@ -1670,13 +1712,16 @@ def destroyOnInterrupt(self): self._ctrlCHandler.setCallback(self._destroyOnInterruptCallback) self._condVar.release() else: - getProcessLogger().error(Application._appName + - ": warning: interrupt method called on Application configured to not handle interrupts.") + getProcessLogger().error( + Application._appName + + ": warning: interrupt method called on Application configured to not handle interrupts." + ) + destroyOnInterrupt = classmethod(destroyOnInterrupt) def shutdownOnInterrupt(self): - '''Configures the application to shutdown its communicator -when interrupted by a signal.''' + """Configures the application to shutdown its communicator + when interrupted by a signal.""" if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() == self._holdInterruptCallback: @@ -1685,12 +1730,15 @@ def shutdownOnInterrupt(self): self._ctrlCHandler.setCallback(self._shutdownOnInterruptCallback) self._condVar.release() else: - getProcessLogger().error(Application._appName + - ": warning: interrupt method called on Application configured to not handle interrupts.") + getProcessLogger().error( + Application._appName + + ": warning: interrupt method called on Application configured to not handle interrupts." + ) + shutdownOnInterrupt = classmethod(shutdownOnInterrupt) def ignoreInterrupt(self): - '''Configures the application to ignore signals.''' + """Configures the application to ignore signals.""" if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() == self._holdInterruptCallback: @@ -1699,13 +1747,16 @@ def ignoreInterrupt(self): self._ctrlCHandler.setCallback(None) self._condVar.release() else: - getProcessLogger().error(Application._appName + - ": warning: interrupt method called on Application configured to not handle interrupts.") + getProcessLogger().error( + Application._appName + + ": warning: interrupt method called on Application configured to not handle interrupts." + ) + ignoreInterrupt = classmethod(ignoreInterrupt) def callbackOnInterrupt(self): - '''Configures the application to invoke interruptCallback -when interrupted by a signal.''' + """Configures the application to invoke interruptCallback + when interrupted by a signal.""" if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() == self._holdInterruptCallback: @@ -1714,13 +1765,16 @@ def callbackOnInterrupt(self): self._ctrlCHandler.setCallback(self._callbackOnInterruptCallback) self._condVar.release() else: - getProcessLogger().error(Application._appName + - ": warning: interrupt method called on Application configured to not handle interrupts.") + getProcessLogger().error( + Application._appName + + ": warning: interrupt method called on Application configured to not handle interrupts." + ) + callbackOnInterrupt = classmethod(callbackOnInterrupt) def holdInterrupt(self): - '''Configures the application to queue an interrupt for -later processing.''' + """Configures the application to queue an interrupt for + later processing.""" if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() != self._holdInterruptCallback: @@ -1730,12 +1784,15 @@ def holdInterrupt(self): # else, we were already holding signals self._condVar.release() else: - getProcessLogger().error(Application._appName + - ": warning: interrupt method called on Application configured to not handle interrupts.") + getProcessLogger().error( + Application._appName + + ": warning: interrupt method called on Application configured to not handle interrupts." + ) + holdInterrupt = classmethod(holdInterrupt) def releaseInterrupt(self): - '''Instructs the application to process any queued interrupt.''' + """Instructs the application to process any queued interrupt.""" if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() == self._holdInterruptCallback: @@ -1751,17 +1808,21 @@ def releaseInterrupt(self): # Else nothing to release. self._condVar.release() else: - getProcessLogger().error(Application._appName + - ": warning: interrupt method called on Application configured to not handle interrupts.") + getProcessLogger().error( + Application._appName + + ": warning: interrupt method called on Application configured to not handle interrupts." + ) + releaseInterrupt = classmethod(releaseInterrupt) def interrupted(self): - '''Returns True if the application was interrupted by a -signal, or False otherwise.''' + """Returns True if the application was interrupted by a + signal, or False otherwise.""" self._condVar.acquire() result = self._interrupted self._condVar.release() return result + interrupted = classmethod(interrupted) def _holdInterruptCallback(self, sig): @@ -1778,6 +1839,7 @@ def _holdInterruptCallback(self, sig): self._condVar.release() if callback: callback(sig) + _holdInterruptCallback = classmethod(_holdInterruptCallback) def _destroyOnInterruptCallback(self, sig): @@ -1796,14 +1858,20 @@ def _destroyOnInterruptCallback(self, sig): try: self._communicator.destroy() - except: - getProcessLogger().error(self._appName + " (while destroying in response to signal " + str(sig) + "):" + - traceback.format_exc()) + except Exception: + getProcessLogger().error( + self._appName + + " (while destroying in response to signal " + + str(sig) + + "):" + + traceback.format_exc() + ) self._condVar.acquire() self._callbackInProcess = False self._condVar.notify() self._condVar.release() + _destroyOnInterruptCallback = classmethod(_destroyOnInterruptCallback) def _shutdownOnInterruptCallback(self, sig): @@ -1821,14 +1889,20 @@ def _shutdownOnInterruptCallback(self, sig): try: self._communicator.shutdown() - except: - getProcessLogger().error(self._appName + " (while shutting down in response to signal " + str(sig) + - "):" + traceback.format_exc()) + except Exception: + getProcessLogger().error( + self._appName + + " (while shutting down in response to signal " + + str(sig) + + "):" + + traceback.format_exc() + ) self._condVar.acquire() self._callbackInProcess = False self._condVar.notify() self._condVar.release() + _shutdownOnInterruptCallback = classmethod(_shutdownOnInterruptCallback) def _callbackOnInterruptCallback(self, sig): @@ -1848,9 +1922,14 @@ def _callbackOnInterruptCallback(self, sig): try: self._application.interruptCallback(sig) - except: - getProcessLogger().error(self._appName + " (while interrupting in response to signal " + str(sig) + - "):" + traceback.format_exc()) + except Exception: + getProcessLogger().error( + self._appName + + " (while interrupting in response to signal " + + str(sig) + + "):" + + traceback.format_exc() + ) self._condVar.acquire() self._callbackInProcess = False @@ -1878,24 +1957,69 @@ def _callbackOnInterruptCallback(self, sig): # # Define Ice::Value and Ice::ObjectPrx. # -IcePy._t_Object = IcePy.defineClass('::Ice::Object', Object, (), None, ()) -IcePy._t_Value = IcePy.defineValue('::Ice::Object', Value, -1, (), False, False, None, ()) -IcePy._t_ObjectPrx = IcePy.defineProxy('::Ice::Object', ObjectPrx) +IcePy._t_Object = IcePy.defineClass("::Ice::Object", Object, (), None, ()) +IcePy._t_Value = IcePy.defineValue( + "::Ice::Object", Value, -1, (), False, False, None, () +) +IcePy._t_ObjectPrx = IcePy.defineProxy("::Ice::Object", ObjectPrx) Object._ice_type = IcePy._t_Object -Object._op_ice_isA = IcePy.Operation('ice_isA', OperationMode.Idempotent, OperationMode.Nonmutating, False, None, (), (( - (), IcePy._t_string, False, 0),), (), ((), IcePy._t_bool, False, 0), ()) -Object._op_ice_ping = IcePy.Operation('ice_ping', OperationMode.Idempotent, - OperationMode.Nonmutating, False, None, (), (), (), None, ()) -Object._op_ice_ids = IcePy.Operation('ice_ids', OperationMode.Idempotent, - OperationMode.Nonmutating, False, None, (), (), (), ((), _t_StringSeq, False, 0), ()) -Object._op_ice_id = IcePy.Operation('ice_id', OperationMode.Idempotent, OperationMode.Nonmutating, - False, None, (), (), (), ((), IcePy._t_string, False, 0), ()) - -IcePy._t_LocalObject = IcePy.defineValue('::Ice::LocalObject', object, -1, (), False, False, None, ()) +Object._op_ice_isA = IcePy.Operation( + "ice_isA", + OperationMode.Idempotent, + OperationMode.Nonmutating, + False, + None, + (), + (((), IcePy._t_string, False, 0),), + (), + ((), IcePy._t_bool, False, 0), + (), +) +Object._op_ice_ping = IcePy.Operation( + "ice_ping", + OperationMode.Idempotent, + OperationMode.Nonmutating, + False, + None, + (), + (), + (), + None, + (), +) +Object._op_ice_ids = IcePy.Operation( + "ice_ids", + OperationMode.Idempotent, + OperationMode.Nonmutating, + False, + None, + (), + (), + (), + ((), _t_StringSeq, False, 0), + (), +) +Object._op_ice_id = IcePy.Operation( + "ice_id", + OperationMode.Idempotent, + OperationMode.Nonmutating, + False, + None, + (), + (), + (), + ((), IcePy._t_string, False, 0), + (), +) + +IcePy._t_LocalObject = IcePy.defineValue( + "::Ice::LocalObject", object, -1, (), False, False, None, () +) IcePy._t_UnknownSlicedValue = IcePy.defineValue( - '::Ice::UnknownSlicedValue', UnknownSlicedValue, -1, (), True, False, None, ()) + "::Ice::UnknownSlicedValue", UnknownSlicedValue, -1, (), True, False, None, () +) UnknownSlicedValue._ice_type = IcePy._t_UnknownSlicedValue # @@ -1951,14 +2075,16 @@ def ConnectionLostException__str__(self): def proxyIdentityEqual(lhs, rhs): - '''Determines whether the identities of two proxies are equal.''' + """Determines whether the identities of two proxies are equal.""" return proxyIdentityCompare(lhs, rhs) == 0 def proxyIdentityCompare(lhs, rhs): - '''Compares the identities of two proxies.''' - if (lhs and not isinstance(lhs, ObjectPrx)) or (rhs and not isinstance(rhs, ObjectPrx)): - raise ValueError('argument is not a proxy') + """Compares the identities of two proxies.""" + if (lhs and not isinstance(lhs, ObjectPrx)) or ( + rhs and not isinstance(rhs, ObjectPrx) + ): + raise ValueError("argument is not a proxy") if not lhs and not rhs: return 0 elif not lhs and rhs: @@ -1972,15 +2098,17 @@ def proxyIdentityCompare(lhs, rhs): def proxyIdentityAndFacetEqual(lhs, rhs): - '''Determines whether the identities and facets of two -proxies are equal.''' + """Determines whether the identities and facets of two + proxies are equal.""" return proxyIdentityAndFacetCompare(lhs, rhs) == 0 def proxyIdentityAndFacetCompare(lhs, rhs): - '''Compares the identities and facets of two proxies.''' - if (lhs and not isinstance(lhs, ObjectPrx)) or (rhs and not isinstance(rhs, ObjectPrx)): - raise ValueError('argument is not a proxy') + """Compares the identities and facets of two proxies.""" + if (lhs and not isinstance(lhs, ObjectPrx)) or ( + rhs and not isinstance(rhs, ObjectPrx) + ): + raise ValueError("argument is not a proxy") if not lhs and not rhs: return 0 elif not lhs and rhs: @@ -1996,6 +2124,7 @@ def proxyIdentityAndFacetCompare(lhs, rhs): rf = rhs.ice_getFacet() return (lf > rf) - (lf < rf) + # # Used by generated code. Defining these in the Ice module means the generated code # can avoid the need to qualify the type() and hash() functions with their module @@ -2007,6 +2136,7 @@ def proxyIdentityAndFacetCompare(lhs, rhs): def getType(o): return type(o) + # # Used by generated code. Defining this in the Ice module means the generated code # can avoid the need to qualify the hash() function with its module name. Since @@ -2032,7 +2162,15 @@ def getHash(o): BuiltinFloat = 5 BuiltinDouble = 6 -BuiltinTypes = [BuiltinBool, BuiltinByte, BuiltinShort, BuiltinInt, BuiltinLong, BuiltinFloat, BuiltinDouble] +BuiltinTypes = [ + BuiltinBool, + BuiltinByte, + BuiltinShort, + BuiltinInt, + BuiltinLong, + BuiltinFloat, + BuiltinDouble, +] BuiltinArrayTypes = ["b", "b", "h", "i", "q", "f", "d"] @@ -2047,7 +2185,15 @@ def createArray(view, t, copy): try: import numpy - BuiltinNumpyTypes = [numpy.bool_, numpy.int8, numpy.int16, numpy.int32, numpy.int64, numpy.float32, numpy.float64] + BuiltinNumpyTypes = [ + numpy.bool_, + numpy.int8, + numpy.int16, + numpy.int32, + numpy.int64, + numpy.float32, + numpy.float64, + ] def createNumPyArray(view, t, copy): if t not in BuiltinTypes: diff --git a/python/python/IceBox/Service.py b/python/python/IceBox/Service.py index ebecfdf7d9c..a1143f684ae 100644 --- a/python/python/IceBox/Service.py +++ b/python/python/IceBox/Service.py @@ -20,17 +20,17 @@ import Ice.CommunicatorF_ice # Included module Ice -_M_Ice = Ice.openModule('Ice') +_M_Ice = Ice.openModule("Ice") # Start of module IceBox -_M_IceBox = Ice.openModule('IceBox') -__name__ = 'IceBox' +_M_IceBox = Ice.openModule("IceBox") +__name__ = "IceBox" _M_IceBox.__doc__ = """ IceBox is an application server specifically for Ice applications. IceBox can easily run and administer Ice services that are dynamically loaded as a DLL, shared library, or Java class. """ -if 'FailureException' not in _M_IceBox.__dict__: +if "FailureException" not in _M_IceBox.__dict__: _M_IceBox.FailureException = Ice.createTempClass() class FailureException(Ice.LocalException): @@ -41,7 +41,7 @@ class FailureException(Ice.LocalException): reason -- The reason for the failure. """ - def __init__(self, reason=''): + def __init__(self, reason=""): self.reason = reason def __str__(self): @@ -49,26 +49,32 @@ def __str__(self): __repr__ = __str__ - _ice_id = '::IceBox::FailureException' + _ice_id = "::IceBox::FailureException" _M_IceBox._t_FailureException = IcePy.defineException( - '::IceBox::FailureException', FailureException, (), False, None, (('reason', (), IcePy._t_string, False, 0),)) + "::IceBox::FailureException", + FailureException, + (), + False, + None, + (("reason", (), IcePy._t_string, False, 0),), + ) FailureException._ice_type = _M_IceBox._t_FailureException _M_IceBox.FailureException = FailureException del FailureException -if 'Service' not in _M_IceBox.__dict__: +if "Service" not in _M_IceBox.__dict__: _M_IceBox.Service = Ice.createTempClass() class Service(object): """ - An application service managed by a ServiceManager. + An application service managed by a ServiceManager. """ def __init__(self): if Ice.getType(self) == _M_IceBox.Service: - raise RuntimeError('IceBox.Service is an abstract class') + raise RuntimeError("IceBox.Service is an abstract class") def start(self, name, communicator, args): """ @@ -86,7 +92,7 @@ def start(self, name, communicator, args): def stop(self): """ - Stop the service. + Stop the service. """ raise NotImplementedError("method 'stop' not implemented") @@ -95,7 +101,9 @@ def __str__(self): __repr__ = __str__ - _M_IceBox._t_Service = IcePy.defineValue('::IceBox::Service', Service, -1, (), False, True, None, ()) + _M_IceBox._t_Service = IcePy.defineValue( + "::IceBox::Service", Service, -1, (), False, True, None, () + ) Service._ice_type = _M_IceBox._t_Service _M_IceBox.Service = Service diff --git a/python/python/IceBox/__init__.py b/python/python/IceBox/__init__.py index 3e8fa6c7284..5fcb8db2345 100644 --- a/python/python/IceBox/__init__.py +++ b/python/python/IceBox/__init__.py @@ -2,10 +2,9 @@ # import Ice + Ice.updateModule("IceBox") # Modules: -import IceBox.ServiceManager_ice -import IceBox.Service_ice # Submodules: diff --git a/python/scripts/slice2py.py b/python/scripts/slice2py.py index 8e07b0a9471..3b89cb25a15 100755 --- a/python/scripts/slice2py.py +++ b/python/scripts/slice2py.py @@ -12,7 +12,7 @@ def main(): sliceDir = Ice.getSliceDir() # Automatically add the slice dir. if sliceDir is not None: - sys.argv.append('-I' + sliceDir) + sys.argv.append("-I" + sliceDir) val = IcePy.compile(sys.argv) sys.exit(int(val)) diff --git a/python/test/Glacier2/application/Client.py b/python/test/Glacier2/application/Client.py index 0f08a85f60b..3caaa379635 100644 --- a/python/test/Glacier2/application/Client.py +++ b/python/test/Glacier2/application/Client.py @@ -9,17 +9,17 @@ import Glacier2 from TestHelper import TestHelper + TestHelper.loadSlice("Callback.ice") import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CallbackReceiverI(Test.CallbackReceiver): - def __init__(self): self._received = False self._cond = threading.Condition() @@ -37,7 +37,6 @@ def waitForCallback(self): class Application(Glacier2.Application): - def __init__(self, helper): Glacier2.Application.__init__(self) self._restart = 0 @@ -46,10 +45,11 @@ def __init__(self, helper): self._helper = helper def createSession(self): - return Glacier2.SessionPrx.uncheckedCast(self.router().createSession("userid", "abc123")) + return Glacier2.SessionPrx.uncheckedCast( + self.router().createSession("userid", "abc123") + ) def runWithSession(self, args): - test(self.router()) test(self.categoryForClient()) test(self.objectAdapter()) @@ -58,12 +58,19 @@ def runWithSession(self, args): sys.stdout.write("testing Glacier2::Application restart... ") sys.stdout.flush() - base = self.communicator().stringToProxy("callback:{0}".format( - self._helper.getTestEndpoint(properties=self.communicator().getProperties()))) + base = self.communicator().stringToProxy( + "callback:{0}".format( + self._helper.getTestEndpoint( + properties=self.communicator().getProperties() + ) + ) + ) callback = Test.CallbackPrx.uncheckedCast(base) self._restart += 1 if self._restart < 5: - receiver = Test.CallbackReceiverPrx.uncheckedCast(self.addWithUUID(self._receiver)) + receiver = Test.CallbackReceiverPrx.uncheckedCast( + self.addWithUUID(self._receiver) + ) callback.initiateCallback(receiver) self._receiver.waitForCallback() self.restart() @@ -81,12 +88,15 @@ def sessionDestroyed(self): class Client(TestHelper): - def run(self, args): initData = Ice.InitializationData() initData.properties = self.createTestProperties(args) - initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:{0}".format( - self.getTestEndpoint(properties=initData.properties, num=50))) + initData.properties.setProperty( + "Ice.Default.Router", + "Glacier2/router:{0}".format( + self.getTestEndpoint(properties=initData.properties, num=50) + ), + ) app = Application(self) status = app.main(sys.argv, initData=initData) @@ -98,8 +108,11 @@ def run(self, args): with self.initialize(initData=initData) as communicator: sys.stdout.write("testing stringToProxy for process object... ") sys.stdout.flush() - processBase = communicator.stringToProxy("Glacier2/admin -f Process:{0}".format( - self.getTestEndpoint(properties=initData.properties, num=51))) + processBase = communicator.stringToProxy( + "Glacier2/admin -f Process:{0}".format( + self.getTestEndpoint(properties=initData.properties, num=51) + ) + ) print("ok") sys.stdout.write("testing checked cast for admin object... ") diff --git a/python/test/Glacier2/application/Server.py b/python/test/Glacier2/application/Server.py index 25d3a738cac..239aa867e79 100644 --- a/python/test/Glacier2/application/Server.py +++ b/python/test/Glacier2/application/Server.py @@ -4,13 +4,13 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Callback.ice') + +TestHelper.loadSlice("Callback.ice") import Ice import Test class CallbackI(Test.Callback): - def initiateCallback(self, proxy, current): proxy.callback(current.ctx) @@ -19,13 +19,16 @@ def shutdown(self, current): class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("DeactivatedAdapter.Endpoints", self.getTestEndpoint(num=1)) + communicator.getProperties().setProperty( + "DeactivatedAdapter.Endpoints", self.getTestEndpoint(num=1) + ) communicator.createObjectAdapter("DeactivatedAdapter") - communicator.getProperties().setProperty("CallbackAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "CallbackAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("CallbackAdapter") adapter.add(CallbackI(), Ice.stringToIdentity("callback")) adapter.activate() diff --git a/python/test/Ice/acm/AllTests.py b/python/test/Ice/acm/AllTests.py index 3b27dfae515..2781cf8c4c0 100644 --- a/python/test/Ice/acm/AllTests.py +++ b/python/test/Ice/acm/AllTests.py @@ -12,7 +12,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class LoggerI(Ice.Logger): @@ -80,21 +80,28 @@ def __init__(self, name, com): self.m = threading.Condition() def init(self): - self._adapter = \ - self._com.createObjectAdapter(self._serverACMTimeout, self._serverACMClose, self._serverACMHeartbeat) + self._adapter = self._com.createObjectAdapter( + self._serverACMTimeout, self._serverACMClose, self._serverACMHeartbeat + ) initData = Ice.InitializationData() initData.properties = self._com.ice_getCommunicator().getProperties().clone() initData.logger = self._logger initData.properties.setProperty("Ice.ACM.Timeout", "2") if self._clientACMTimeout >= 0: - initData.properties.setProperty("Ice.ACM.Client.Timeout", str(self._clientACMTimeout)) + initData.properties.setProperty( + "Ice.ACM.Client.Timeout", str(self._clientACMTimeout) + ) if self._clientACMClose >= 0: - initData.properties.setProperty("Ice.ACM.Client.Close", str(self._clientACMClose)) + initData.properties.setProperty( + "Ice.ACM.Client.Close", str(self._clientACMClose) + ) if self._clientACMHeartbeat >= 0: - initData.properties.setProperty("Ice.ACM.Client.Heartbeat", str(self._clientACMHeartbeat)) - #initData.properties.setProperty("Ice.Trace.Protocol", "2") - #initData.properties.setProperty("Ice.Trace.Network", "2") + initData.properties.setProperty( + "Ice.ACM.Client.Heartbeat", str(self._clientACMHeartbeat) + ) + # initData.properties.setProperty("Ice.Trace.Protocol", "2") + # initData.properties.setProperty("Ice.Trace.Network", "2") self._communicator = Ice.initialize(initData) def destroy(self): @@ -113,14 +120,17 @@ def joinWithThread(self): test(False) def run(self): - proxy = Test.TestIntfPrx.uncheckedCast(self._communicator.stringToProxy( - self._adapter.getTestIntf().ice_toString())) + proxy = Test.TestIntfPrx.uncheckedCast( + self._communicator.stringToProxy(self._adapter.getTestIntf().ice_toString()) + ) try: proxy.ice_getConnection().setCloseCallback(lambda conn: self.closed(conn)) - proxy.ice_getConnection().setHeartbeatCallback(lambda conn: self.heartbeat(conn)) + proxy.ice_getConnection().setHeartbeatCallback( + lambda conn: self.heartbeat(conn) + ) self.runTestCase(self._adapter, proxy) - except Exception as ex: + except Exception: self._msg = "unexpected exception:\n" + traceback.format_exc() def heartbeat(self, con): @@ -163,7 +173,9 @@ def allTests(helper, communicator): class InvocationHeartbeatTest(TestCase): def __init__(self, com): TestCase.__init__(self, "invocation heartbeat", com) - self.setServerACM(1, -1, -1) # Faster ACM to make sure we receive enough ACM heartbeats + self.setServerACM( + 1, -1, -1 + ) # Faster ACM to make sure we receive enough ACM heartbeats def runTestCase(self, adapter, proxy): proxy.sleep(4) @@ -209,7 +221,9 @@ def runTestCase(self, adapter, proxy): class InvocationHeartbeatCloseOnIdleTest(TestCase): def __init__(self, com): - TestCase.__init__(self, "invocation with no heartbeat and close on idle", com) + TestCase.__init__( + self, "invocation with no heartbeat and close on idle", com + ) self.setClientACM(1, 1, 0) # Only close on idle. self.setServerACM(1, 2, 0) # Disable heartbeat on invocations @@ -343,8 +357,11 @@ def runTestCase(self, adapter, proxy): test(acm.close == Ice.ACMClose.CloseOnIdleForceful) test(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatOff) - proxy.ice_getCachedConnection().setACM(1, Ice.ACMClose.CloseOnInvocationAndIdle, - Ice.ACMHeartbeat.HeartbeatAlways) + proxy.ice_getCachedConnection().setACM( + 1, + Ice.ACMClose.CloseOnInvocationAndIdle, + Ice.ACMHeartbeat.HeartbeatAlways, + ) acm = proxy.ice_getCachedConnection().getACM() test(acm.timeout == 1) test(acm.close == Ice.ACMClose.CloseOnInvocationAndIdle) diff --git a/python/test/Ice/acm/Client.py b/python/test/Ice/acm/Client.py index decef7579f5..dee65d89d43 100755 --- a/python/test/Ice/acm/Client.py +++ b/python/test/Ice/acm/Client.py @@ -4,14 +4,14 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) - properties.setProperty('Ice.Warn.Connections', '0') + properties.setProperty("Ice.Warn.Connections", "0") with self.initialize(properties=properties) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/acm/Server.py b/python/test/Ice/acm/Server.py index 6892577191c..d26ffe162b5 100755 --- a/python/test/Ice/acm/Server.py +++ b/python/test/Ice/acm/Server.py @@ -5,22 +5,25 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI class Server(TestHelper): - def run(self, args): - properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Connections", "0") properties.setProperty("Ice.ACM.Timeout", "1") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) communicator.getProperties().setProperty("TestAdapter.ACM.Timeout", "0") adapter = communicator.createObjectAdapter("TestAdapter") - adapter.add(TestI.RemoteCommunicatorI(), Ice.stringToIdentity("communicator")) + adapter.add( + TestI.RemoteCommunicatorI(), Ice.stringToIdentity("communicator") + ) adapter.activate() # Disable ready print for further adapters. diff --git a/python/test/Ice/acm/TestI.py b/python/test/Ice/acm/TestI.py index 5beaed7a837..6869492be42 100644 --- a/python/test/Ice/acm/TestI.py +++ b/python/test/Ice/acm/TestI.py @@ -7,7 +7,7 @@ import threading -class ConnectionCallbackI(): +class ConnectionCallbackI: def __init__(self): self.m = threading.Condition() self.count = 0 @@ -38,7 +38,9 @@ def createObjectAdapter(self, timeout, close, heartbeat, current=None): properties.setProperty(name + ".ACM.Heartbeat", str(heartbeat)) properties.setProperty(name + ".ThreadPool.Size", "2") adapter = com.createObjectAdapterWithEndpoints(name, protocol + " -h 127.0.0.1") - return Test.RemoteObjectAdapterPrx.uncheckedCast(current.adapter.addWithUUID(RemoteObjectAdapterI(adapter))) + return Test.RemoteObjectAdapterPrx.uncheckedCast( + current.adapter.addWithUUID(RemoteObjectAdapterI(adapter)) + ) def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -47,8 +49,9 @@ def shutdown(self, current=None): class RemoteObjectAdapterI(Test.RemoteObjectAdapter): def __init__(self, adapter): self._adapter = adapter - self._testIntf = Test.TestIntfPrx.uncheckedCast(adapter.add(TestIntfI(), - Ice.stringToIdentity("test"))) + self._testIntf = Test.TestIntfPrx.uncheckedCast( + adapter.add(TestIntfI(), Ice.stringToIdentity("test")) + ) adapter.activate() def getTestIntf(self, current=None): diff --git a/python/test/Ice/adapterDeactivation/AllTests.py b/python/test/Ice/adapterDeactivation/AllTests.py index d92f34706ba..09c5d4fe312 100644 --- a/python/test/Ice/adapterDeactivation/AllTests.py +++ b/python/test/Ice/adapterDeactivation/AllTests.py @@ -9,7 +9,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): @@ -28,7 +28,9 @@ def allTests(helper, communicator): sys.stdout.write("creating/destroying/recreating object adapter... ") sys.stdout.flush() - adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default") + adapter = communicator.createObjectAdapterWithEndpoints( + "TransientTestAdapter", "default" + ) try: communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default") test(False) @@ -36,11 +38,15 @@ def allTests(helper, communicator): pass adapter.destroy() - adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default") + adapter = communicator.createObjectAdapterWithEndpoints( + "TransientTestAdapter", "default" + ) adapter.destroy() print("ok") - sys.stdout.write("creating/activating/deactivating object adapter in one operation... ") + sys.stdout.write( + "creating/activating/deactivating object adapter in one operation... " + ) sys.stdout.flush() obj.transient() print("ok") @@ -58,12 +64,16 @@ def allTests(helper, communicator): sys.stdout.write("testing object adapter published endpoints... ") sys.stdout.flush() - communicator.getProperties().setProperty("PAdapter.PublishedEndpoints", "tcp -h localhost -p 12345 -t 30000") + communicator.getProperties().setProperty( + "PAdapter.PublishedEndpoints", "tcp -h localhost -p 12345 -t 30000" + ) adapter = communicator.createObjectAdapter("PAdapter") test(len(adapter.getPublishedEndpoints()) == 1) endpt = adapter.getPublishedEndpoints()[0] test(str(endpt) == "tcp -h localhost -p 12345 -t 30000") - prx = communicator.stringToProxy("dummy:tcp -h localhost -p 12346 -t 20000:tcp -h localhost -p 12347 -t 10000") + prx = communicator.stringToProxy( + "dummy:tcp -h localhost -p 12346 -t 20000:tcp -h localhost -p 12347 -t 10000" + ) adapter.setPublishedEndpoints(prx.ice_getEndpoints()) test(len(adapter.getPublishedEndpoints()) == 2) ident = Ice.Identity() @@ -73,10 +83,14 @@ def allTests(helper, communicator): adapter.refreshPublishedEndpoints() test(len(adapter.getPublishedEndpoints()) == 1) test(adapter.getPublishedEndpoints()[0] == endpt) - communicator.getProperties().setProperty("PAdapter.PublishedEndpoints", "tcp -h localhost -p 12345 -t 20000") + communicator.getProperties().setProperty( + "PAdapter.PublishedEndpoints", "tcp -h localhost -p 12345 -t 20000" + ) adapter.refreshPublishedEndpoints() test(len(adapter.getPublishedEndpoints()) == 1) - test(str(adapter.getPublishedEndpoints()[0]) == "tcp -h localhost -p 12345 -t 20000") + test( + str(adapter.getPublishedEndpoints()[0]) == "tcp -h localhost -p 12345 -t 20000" + ) adapter.destroy() test(len(adapter.getPublishedEndpoints()) == 0) @@ -100,17 +114,23 @@ def allTests(helper, communicator): sys.stdout.flush() routerId = Ice.Identity() routerId.name = "router" - router = Ice.RouterPrx.uncheckedCast(base.ice_identity(routerId).ice_connectionId("rc")) + router = Ice.RouterPrx.uncheckedCast( + base.ice_identity(routerId).ice_connectionId("rc") + ) adapter = communicator.createObjectAdapterWithRouter("", router) test(len(adapter.getPublishedEndpoints()) == 1) - test(str(adapter.getPublishedEndpoints()[0]) == "tcp -h localhost -p 23456 -t 30000") + test( + str(adapter.getPublishedEndpoints()[0]) == "tcp -h localhost -p 23456 -t 30000" + ) adapter.refreshPublishedEndpoints() test(len(adapter.getPublishedEndpoints()) == 1) - test(str(adapter.getPublishedEndpoints()[0]) == "tcp -h localhost -p 23457 -t 30000") + test( + str(adapter.getPublishedEndpoints()[0]) == "tcp -h localhost -p 23457 -t 30000" + ) try: adapter.setPublishedEndpoints(router.ice_getEndpoints()) test(False) - except: + except Exception: # Expected. pass adapter.destroy() diff --git a/python/test/Ice/adapterDeactivation/Client.py b/python/test/Ice/adapterDeactivation/Client.py index dc5eb59e999..c38c885efcd 100755 --- a/python/test/Ice/adapterDeactivation/Client.py +++ b/python/test/Ice/adapterDeactivation/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/adapterDeactivation/Collocated.py b/python/test/Ice/adapterDeactivation/Collocated.py index 4b0b80bd335..66b82d8a7ea 100755 --- a/python/test/Ice/adapterDeactivation/Collocated.py +++ b/python/test/Ice/adapterDeactivation/Collocated.py @@ -4,17 +4,18 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests import TestI class Collocated(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") locator = TestI.ServantLocatorI() diff --git a/python/test/Ice/adapterDeactivation/Server.py b/python/test/Ice/adapterDeactivation/Server.py index aa5a5406f64..4a9316f0ce1 100755 --- a/python/test/Ice/adapterDeactivation/Server.py +++ b/python/test/Ice/adapterDeactivation/Server.py @@ -3,15 +3,17 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") locator = TestI.ServantLocatorI() adapter.addServantLocator(locator, "") diff --git a/python/test/Ice/adapterDeactivation/TestI.py b/python/test/Ice/adapterDeactivation/TestI.py index ded6d82df60..85855df53d2 100644 --- a/python/test/Ice/adapterDeactivation/TestI.py +++ b/python/test/Ice/adapterDeactivation/TestI.py @@ -2,9 +2,6 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os -import sys -import traceback import time import Ice import Test @@ -12,13 +9,15 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestI(Test.TestIntf): def transient(self, current=None): communicator = current.adapter.getCommunicator() - adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default") + adapter = communicator.createObjectAdapterWithEndpoints( + "TransientTestAdapter", "default" + ) adapter.activate() adapter.destroy() @@ -28,7 +27,6 @@ def deactivate(self, current=None): class RouterI(Ice.Router): - def __init__(self): self._nextPort = 23456 @@ -38,7 +36,9 @@ def getClientProxy(self, c): def getServerProxy(self, c): port = self._nextPort self._nextPort += 1 - return c.adapter.getCommunicator().stringToProxy("dummy:tcp -h localhost -p {0} -t 30000".format(port)) + return c.adapter.getCommunicator().stringToProxy( + "dummy:tcp -h localhost -p {0} -t 30000".format(port) + ) def addProxies(self, proxies, c): return [] @@ -46,11 +46,10 @@ def addProxies(self, proxies, c): class Cookie: def message(self): - return 'blahblah' + return "blahblah" class ServantLocatorI(Ice.ServantLocator): - def __init__(self): self._deactivated = False self._router = RouterI() @@ -61,22 +60,22 @@ def __del__(self): def locate(self, current): test(not self._deactivated) - if current.id.name == 'router': + if current.id.name == "router": return (self._router, None) - test(current.id.category == '') - test(current.id.name == 'test') + test(current.id.category == "") + test(current.id.name == "test") return (TestI(), Cookie()) def finished(self, current, servant, cookie): test(not self._deactivated) - if current.id.name == 'router': + if current.id.name == "router": return test(isinstance(cookie, Cookie)) - test(cookie.message() == 'blahblah') + test(cookie.message() == "blahblah") def deactivate(self, category): test(not self._deactivated) diff --git a/python/test/Ice/admin/AllTests.py b/python/test/Ice/admin/AllTests.py index 54a6a586c55..1589011869c 100644 --- a/python/test/Ice/admin/AllTests.py +++ b/python/test/Ice/admin/AllTests.py @@ -10,16 +10,15 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def testFacets(com, builtInFacets=True): - if builtInFacets: - test(com.findAdminFacet("Properties") != None) - test(com.findAdminFacet("Process") != None) - test(com.findAdminFacet("Logger") != None) - test(com.findAdminFacet("Metrics") != None) + test(com.findAdminFacet("Properties") is not None) + test(com.findAdminFacet("Process") is not None) + test(com.findAdminFacet("Logger") is not None) + test(com.findAdminFacet("Metrics") is not None) f1 = TestI.TestFacetI() f2 = TestI.TestFacetI() @@ -32,7 +31,7 @@ def testFacets(com, builtInFacets=True): test(com.findAdminFacet("Facet1") == f1) test(com.findAdminFacet("Facet2") == f2) test(com.findAdminFacet("Facet3") == f3) - test(com.findAdminFacet("Bogus") == None) + test(com.findAdminFacet("Bogus") is None) facetMap = com.findAllAdminFacets() if builtInFacets: @@ -115,7 +114,7 @@ def allTests(helper, communicator): init.properties = Ice.createProperties() init.properties.setProperty("Ice.Admin.Enabled", "1") com = Ice.initialize(init) - test(com.getAdmin() == None) + test(com.getAdmin() is None) identity = Ice.stringToIdentity("test-admin") try: com.createAdmin(None, identity) @@ -124,8 +123,8 @@ def allTests(helper, communicator): pass adapter = com.createObjectAdapter("") - test(com.createAdmin(adapter, identity) != None) - test(com.getAdmin() != None) + test(com.createAdmin(adapter, identity) is not None) + test(com.getAdmin() is not None) testFacets(com) com.destroy() @@ -146,7 +145,9 @@ def allTests(helper, communicator): print("ok") ref = "factory:{0} -t 10000".format(helper.getTestEndpoint()) - factory = Test.RemoteCommunicatorFactoryPrx.uncheckedCast(communicator.stringToProxy(ref)) + factory = Test.RemoteCommunicatorFactoryPrx.uncheckedCast( + communicator.stringToProxy(ref) + ) sys.stdout.write("testing process facet... ") sys.stdout.flush() @@ -262,9 +263,9 @@ def allTests(helper, communicator): obj = com.getAdmin() proc = Ice.ProcessPrx.checkedCast(obj, "Process") - test(proc == None) + test(proc is None) tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet") - test(tf == None) + test(tf is None) com.destroy() # @@ -279,9 +280,9 @@ def allTests(helper, communicator): obj = com.getAdmin() pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties") - test(pa == None) + test(pa is None) tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet") - test(tf == None) + test(tf is None) com.destroy() @@ -297,10 +298,10 @@ def allTests(helper, communicator): obj = com.getAdmin() pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties") - test(pa == None) + test(pa is None) proc = Ice.ProcessPrx.checkedCast(obj, "Process") - test(proc == None) + test(proc is None) com.destroy() @@ -320,7 +321,7 @@ def allTests(helper, communicator): tf.op() proc = Ice.ProcessPrx.checkedCast(obj, "Process") - test(proc == None) + test(proc is None) com.destroy() # @@ -335,7 +336,7 @@ def allTests(helper, communicator): obj = com.getAdmin() pa = Ice.PropertiesAdminPrx.checkedCast(obj, "Properties") - test(pa == None) + test(pa is None) tf = Test.TestFacetPrx.checkedCast(obj, "TestFacet") tf.op() diff --git a/python/test/Ice/admin/Client.py b/python/test/Ice/admin/Client.py index dc5eb59e999..c38c885efcd 100644 --- a/python/test/Ice/admin/Client.py +++ b/python/test/Ice/admin/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/admin/Server.py b/python/test/Ice/admin/Server.py index 28aadfd1795..50b655217e1 100644 --- a/python/test/Ice/admin/Server.py +++ b/python/test/Ice/admin/Server.py @@ -5,17 +5,21 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") - adapter.add(TestI.RemoteCommunicatorFactoryI(), Ice.stringToIdentity("factory")) + adapter.add( + TestI.RemoteCommunicatorFactoryI(), Ice.stringToIdentity("factory") + ) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/admin/TestI.py b/python/test/Ice/admin/TestI.py index 399942bc0b6..721112ef1f3 100644 --- a/python/test/Ice/admin/TestI.py +++ b/python/test/Ice/admin/TestI.py @@ -9,7 +9,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestFacetI(Test.TestFacet): @@ -63,7 +63,6 @@ def updated(self, changes): class RemoteCommunicatorFactoryI(Test.RemoteCommunicatorFactory): - def createCommunicator(self, props, current=None): # # Prepare the property set using the given properties. @@ -89,7 +88,7 @@ def createCommunicator(self, props, current=None): # servant = RemoteCommunicatorI(communicator) admin = communicator.findAdminFacet("Properties") - if admin != None: + if admin is not None: admin.addUpdateCallback(servant) proxy = current.adapter.addWithUUID(servant) diff --git a/python/test/Ice/ami/AllTests.py b/python/test/Ice/ami/AllTests.py index fecd21cae0e..0b686474e7d 100644 --- a/python/test/Ice/ami/AllTests.py +++ b/python/test/Ice/ami/AllTests.py @@ -11,7 +11,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class PingReplyI(Test.PingReply): @@ -62,7 +62,7 @@ def ids(self, ids): self.called() def connection(self, conn): - test(conn != None) + test(conn is not None) self.called() def op(self): @@ -77,7 +77,7 @@ def opWithUE(self, ex): raise ex except Test.TestIntfException: self.called() - except: + except Exception: test(False) def ex(self, ex): @@ -110,7 +110,7 @@ def ids(self, ids, cookie): def connection(self, conn, cookie): test(cookie == self._cookie) - test(conn != None) + test(conn is not None) self.called() def op(self, cookie): @@ -128,7 +128,7 @@ def opWithUE(self, ex, cookie): raise ex except Test.TestIntfException: self.called() - except: + except Exception: test(False) def ex(self, ex, cookie): @@ -191,8 +191,10 @@ def ex(self, ex): pass def sent(self, sentSynchronously): - test((sentSynchronously and self._thread == threading.currentThread()) or - (not sentSynchronously and self._thread != threading.currentThread())) + test( + (sentSynchronously and self._thread == threading.currentThread()) + or (not sentSynchronously and self._thread != threading.currentThread()) + ) self.called() @@ -210,8 +212,10 @@ def ex(self, ex, cookie): def sent(self, sentSynchronously, cookie): test(cookie == self._cookie) - test((sentSynchronously and self._thread == threading.currentThread()) or - (not sentSynchronously and self._thread != threading.currentThread())) + test( + (sentSynchronously and self._thread == threading.currentThread()) + or (not sentSynchronously and self._thread != threading.currentThread()) + ) self.called() @@ -228,13 +232,17 @@ def exceptionWC(self, ex, cookie): test(False) def sent(self, sentSynchronously): - test((sentSynchronously and self._thread == threading.currentThread()) or - (not sentSynchronously and self._thread != threading.currentThread())) + test( + (sentSynchronously and self._thread == threading.currentThread()) + or (not sentSynchronously and self._thread != threading.currentThread()) + ) self.called() def sentWC(self, sentSynchronously, cookie): - test((sentSynchronously and self._thread == threading.currentThread()) or - (not sentSynchronously and self._thread != threading.currentThread())) + test( + (sentSynchronously and self._thread == threading.currentThread()) + or (not sentSynchronously and self._thread != threading.currentThread()) + ) test(cookie == self._cookie) self.called() @@ -275,7 +283,7 @@ def ids(self, f): self.called() def connection(self, f): - test(f.result() != None) + test(f.result() is not None) self.called() def op(self, f): @@ -291,7 +299,7 @@ def opWithUE(self, f): test(False) except Test.TestIntfException: self.called() - except: + except Exception: test(False) @@ -416,10 +424,7 @@ def allTests(helper, communicator, collocated): obj = communicator.stringToProxy(sref) test(obj) - testController = Test.TestIntfControllerPrx.uncheckedCast(obj) - if p.ice_getConnection() and p.supportsAMD(): - sys.stdout.write("testing graceful close connection without wait... ") sys.stdout.flush() @@ -452,7 +457,7 @@ def allTests(helper, communicator, collocated): cb.check() # Ensure connection was closed. try: f.result() - except: + except Exception: test(False) print("ok") @@ -521,7 +526,7 @@ def allTestsFuture(helper, communicator, collocated): test(len(p.ice_idsAsync(ctx).result()) == 2) if not collocated: - test(p.ice_getConnectionAsync().result() != None) + test(p.ice_getConnectionAsync().result() is not None) p.opAsync().result() p.opAsync(ctx).result() @@ -776,11 +781,15 @@ def allTestsFuture(helper, communicator, collocated): sys.stdout.flush() test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) b1.opBatch() b1.opBatch() cb = FutureFlushCallback() - f = b1.ice_getConnection().flushBatchRequestsAsync(Ice.CompressBatch.BasedOnProxy) + f = b1.ice_getConnection().flushBatchRequestsAsync( + Ice.CompressBatch.BasedOnProxy + ) f.add_sent_callback(cb.sent) cb.check() f.result() # Wait until finished. @@ -789,11 +798,15 @@ def allTestsFuture(helper, communicator, collocated): test(p.waitForBatch(2)) test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) b1.opBatch() b1.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait) cb = FutureFlushExCallback() - f = b1.ice_getConnection().flushBatchRequestsAsync(Ice.CompressBatch.BasedOnProxy) + f = b1.ice_getConnection().flushBatchRequestsAsync( + Ice.CompressBatch.BasedOnProxy + ) f.add_done_callback(cb.exception) f.add_sent_callback(cb.sent) cb.check() @@ -810,7 +823,9 @@ def allTestsFuture(helper, communicator, collocated): # 1 connection. # test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) b1.opBatch() b1.opBatch() cb = FutureFlushCallback() @@ -826,7 +841,9 @@ def allTestsFuture(helper, communicator, collocated): # 1 connection. # test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) b1.opBatch() b1.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait) cb = FutureFlushCallback() @@ -842,9 +859,15 @@ def allTestsFuture(helper, communicator, collocated): # 2 connections. # test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) - b2 = Test.TestIntfPrx.uncheckedCast(p.ice_connectionId("2").ice_getConnection().createProxy( - p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) + b2 = Test.TestIntfPrx.uncheckedCast( + p.ice_connectionId("2") + .ice_getConnection() + .createProxy(p.ice_getIdentity()) + .ice_batchOneway() + ) b2.ice_getConnection() # Ensure connection is established. b1.opBatch() b1.opBatch() @@ -866,9 +889,15 @@ def allTestsFuture(helper, communicator, collocated): # Exceptions should not be reported. # test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) - b2 = Test.TestIntfPrx.uncheckedCast(p.ice_connectionId("2").ice_getConnection().createProxy( - p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) + b2 = Test.TestIntfPrx.uncheckedCast( + p.ice_connectionId("2") + .ice_getConnection() + .createProxy(p.ice_getIdentity()) + .ice_batchOneway() + ) b2.ice_getConnection() # Ensure connection is established. b1.opBatch() b2.opBatch() @@ -888,9 +917,15 @@ def allTestsFuture(helper, communicator, collocated): # The sent callback should be invoked even if all connections fail. # test(p.opBatchCount() == 0) - b1 = Test.TestIntfPrx.uncheckedCast(p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway()) - b2 = Test.TestIntfPrx.uncheckedCast(p.ice_connectionId("2").ice_getConnection().createProxy( - p.ice_getIdentity()).ice_batchOneway()) + b1 = Test.TestIntfPrx.uncheckedCast( + p.ice_getConnection().createProxy(p.ice_getIdentity()).ice_batchOneway() + ) + b2 = Test.TestIntfPrx.uncheckedCast( + p.ice_connectionId("2") + .ice_getConnection() + .createProxy(p.ice_getIdentity()) + .ice_batchOneway() + ) b2.ice_getConnection() # Ensure connection is established. b1.opBatch() b2.opBatch() @@ -925,7 +960,7 @@ def allTestsFuture(helper, communicator, collocated): f1 = p.opAsync() b = [random.randint(0, 255) for x in range(0, 1024)] seq = bytes(b) - while (True): + while True: f2 = p.opWithPayloadAsync(seq) if not f2.is_sent_synchronously(): break @@ -934,8 +969,10 @@ def allTestsFuture(helper, communicator, collocated): test(f1 != f2) if p.ice_getConnection(): - test((f1.is_sent_synchronously() and f1.is_sent() and not f1.done()) or - (not f1.is_sent_synchronously() and not f1.done())) + test( + (f1.is_sent_synchronously() and f1.is_sent() and not f1.done()) + or (not f1.is_sent_synchronously() and not f1.done()) + ) test(not f2.is_sent_synchronously() and not f2.done()) except Exception as ex: @@ -963,7 +1000,7 @@ def allTestsFuture(helper, communicator, collocated): # f = p.ice_pingAsync() test(f.operation() == "ice_ping") - test(f.connection() == None) # Expected + test(f.connection() is None) # Expected test(f.communicator() == communicator) test(f.proxy() == p) f.result() @@ -974,7 +1011,7 @@ def allTestsFuture(helper, communicator, collocated): p2 = p.ice_oneway() f = p2.ice_pingAsync() test(f.operation() == "ice_ping") - test(f.connection() == None) # Expected + test(f.connection() is None) # Expected test(f.communicator() == communicator) test(f.proxy() == p2) @@ -984,7 +1021,7 @@ def allTestsFuture(helper, communicator, collocated): p2 = p.ice_batchOneway() p2.ice_ping() f = p2.ice_flushBatchRequestsAsync() - test(f.connection() == None) # Expected + test(f.connection() is None) # Expected test(f.communicator() == communicator) test(f.proxy() == p2) f.result() @@ -999,7 +1036,7 @@ def allTestsFuture(helper, communicator, collocated): f = con.flushBatchRequestsAsync(Ice.CompressBatch.BasedOnProxy) test(f.connection() == con) test(f.communicator() == communicator) - test(f.proxy() == None) # Expected + test(f.proxy() is None) # Expected f.result() # @@ -1008,12 +1045,12 @@ def allTestsFuture(helper, communicator, collocated): p2 = p.ice_batchOneway() p2.ice_ping() f = communicator.flushBatchRequestsAsync(Ice.CompressBatch.BasedOnProxy) - test(f.connection() == None) # Expected + test(f.connection() is None) # Expected test(f.communicator() == communicator) - test(f.proxy() == None) # Expected + test(f.proxy() is None) # Expected f.result() - if (p.ice_getConnection()): + if p.ice_getConnection(): f1 = None f2 = None @@ -1034,13 +1071,13 @@ def allTestsFuture(helper, communicator, collocated): try: f1.result() test(False) - except (Ice.InvocationCanceledException): + except Ice.InvocationCanceledException: pass try: f2.result() test(False) - except (Ice.InvocationCanceledException): + except Ice.InvocationCanceledException: pass testController.resumeAdapter() @@ -1059,12 +1096,12 @@ def allTestsFuture(helper, communicator, collocated): try: f1.result() test(False) - except: + except Exception: pass try: f2.result() test(False) - except: + except Exception: pass testController.resumeAdapter() diff --git a/python/test/Ice/ami/Client.py b/python/test/Ice/ami/Client.py index 78c31b68c49..50e9e399181 100755 --- a/python/test/Ice/ami/Client.py +++ b/python/test/Ice/ami/Client.py @@ -4,16 +4,16 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) - properties.setProperty('Ice.Warn.AMICallback', '0') - properties.setProperty('Ice.Warn.Connections', '0') + properties.setProperty("Ice.Warn.AMICallback", "0") + properties.setProperty("Ice.Warn.Connections", "0") # # Limit the send buffer size, this test relies on the socket diff --git a/python/test/Ice/ami/Collocated.py b/python/test/Ice/ami/Collocated.py index 13f659a632a..3ef947a3243 100755 --- a/python/test/Ice/ami/Collocated.py +++ b/python/test/Ice/ami/Collocated.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests import TestI @@ -11,9 +12,7 @@ class Collocated(TestHelper): - def run(self, args): - properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.AMICallback", "0") # @@ -22,10 +21,15 @@ def run(self, args): properties.setProperty("Ice.Warn.Connections", "0") with self.initialize(properties=properties) as communicator: - - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", self.getTestEndpoint(num=1)) - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1") + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) + communicator.getProperties().setProperty( + "ControllerAdapter.Endpoints", self.getTestEndpoint(num=1) + ) + communicator.getProperties().setProperty( + "ControllerAdapter.ThreadPool.Size", "1" + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter2 = communicator.createObjectAdapter("ControllerAdapter") diff --git a/python/test/Ice/ami/Server.py b/python/test/Ice/ami/Server.py index a839cb702e5..ce783efadc3 100755 --- a/python/test/Ice/ami/Server.py +++ b/python/test/Ice/ami/Server.py @@ -5,14 +5,13 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI class Server(TestHelper): - def run(self, args): - properties = self.createTestProperties(args) # # This test kills connections, so we don't want warnings. @@ -26,10 +25,15 @@ def run(self, args): properties.setProperty("Ice.TCP.RcvSize", "50000") with self.initialize(properties=properties) as communicator: - - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", self.getTestEndpoint(num=1)) - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1") + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) + communicator.getProperties().setProperty( + "ControllerAdapter.Endpoints", self.getTestEndpoint(num=1) + ) + communicator.getProperties().setProperty( + "ControllerAdapter.ThreadPool.Size", "1" + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter2 = communicator.createObjectAdapter("ControllerAdapter") diff --git a/python/test/Ice/ami/TestI.py b/python/test/Ice/ami/TestI.py index 71389287856..11781902428 100644 --- a/python/test/Ice/ami/TestI.py +++ b/python/test/Ice/ami/TestI.py @@ -67,7 +67,9 @@ def finishDispatch(self, current=None): with self._cond: if self._shutdown: return - elif self._pending: # Pending might not be set yet if startDispatch is dispatch out-of-order + elif ( + self._pending + ): # Pending might not be set yet if startDispatch is dispatch out-of-order self._pending.set_result(None) self._pending = None diff --git a/python/test/Ice/asyncio/test.py b/python/test/Ice/asyncio/test.py index c688472887d..08f95039b16 100644 --- a/python/test/Ice/asyncio/test.py +++ b/python/test/Ice/asyncio/test.py @@ -6,5 +6,8 @@ # This test requires asyncio methods which are only available with Python 3.7 +from Util import TestSuite, currentConfig + + if currentConfig.getPythonVersion() >= (3, 7): TestSuite(__name__) diff --git a/python/test/Ice/binding/AllTests.py b/python/test/Ice/binding/AllTests.py index f0ce612b758..c3acb6a5246 100644 --- a/python/test/Ice/binding/AllTests.py +++ b/python/test/Ice/binding/AllTests.py @@ -11,7 +11,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class GetAdapterNameCB: @@ -133,7 +133,9 @@ def allTests(helper, communicator): test(i == nRetry) for a in adapters: - a.getTestIntf().ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait) + a.getTestIntf().ice_getConnection().close( + Ice.ConnectionClose.GracefullyWithWait + ) # # Deactivate an adapter and ensure that we can still @@ -217,7 +219,9 @@ def allTests(helper, communicator): test(i == nRetry) for a in adapters: - a.getTestIntf().ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait) + a.getTestIntf().ice_getConnection().close( + Ice.ConnectionClose.GracefullyWithWait + ) # # Deactivate an adapter and ensure that we can still @@ -273,7 +277,9 @@ def allTests(helper, communicator): names.remove(name) t.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait) - t = Test.TestIntfPrx.uncheckedCast(t.ice_endpointSelection(Ice.EndpointSelectionType.Random)) + t = Test.TestIntfPrx.uncheckedCast( + t.ice_endpointSelection(Ice.EndpointSelectionType.Random) + ) test(t.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random) names.append("Adapter21") @@ -298,7 +304,9 @@ def allTests(helper, communicator): adapters.append(com.createObjectAdapter("Adapter33", "default")) t = createTestIntfPrx(adapters) - t = Test.TestIntfPrx.uncheckedCast(t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)) + t = Test.TestIntfPrx.uncheckedCast( + t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) + ) test(t.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered) nRetry = 5 @@ -364,8 +372,12 @@ def allTests(helper, communicator): adapter = com.createObjectAdapter("Adapter41", "default") - test1 = Test.TestIntfPrx.uncheckedCast(adapter.getTestIntf().ice_connectionCached(False)) - test2 = Test.TestIntfPrx.uncheckedCast(adapter.getTestIntf().ice_connectionCached(False)) + test1 = Test.TestIntfPrx.uncheckedCast( + adapter.getTestIntf().ice_connectionCached(False) + ) + test2 = Test.TestIntfPrx.uncheckedCast( + adapter.getTestIntf().ice_connectionCached(False) + ) test(not test1.ice_isConnectionCached()) test(not test2.ice_isConnectionCached()) test(test1.ice_getConnection() == test2.ice_getConnection()) @@ -393,7 +405,9 @@ def allTests(helper, communicator): adapters.append(com.createObjectAdapter("Adapter52", "default")) adapters.append(com.createObjectAdapter("Adapter53", "default")) - t = Test.TestIntfPrx.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(False)) + t = Test.TestIntfPrx.uncheckedCast( + createTestIntfPrx(adapters).ice_connectionCached(False) + ) test(not t.ice_isConnectionCached()) names = ["Adapter51", "Adapter52", "Adapter53"] @@ -427,7 +441,9 @@ def allTests(helper, communicator): adapters.append(com.createObjectAdapter("AdapterAMI52", "default")) adapters.append(com.createObjectAdapter("AdapterAMI53", "default")) - t = Test.TestIntfPrx.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(False)) + t = Test.TestIntfPrx.uncheckedCast( + createTestIntfPrx(adapters).ice_connectionCached(False) + ) test(not t.ice_isConnectionCached()) names = ["AdapterAMI51", "AdapterAMI52", "AdapterAMI53"] @@ -462,7 +478,9 @@ def allTests(helper, communicator): adapters.append(com.createObjectAdapter("Adapter63", "default")) t = createTestIntfPrx(adapters) - t = Test.TestIntfPrx.uncheckedCast(t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)) + t = Test.TestIntfPrx.uncheckedCast( + t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) + ) test(t.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered) t = Test.TestIntfPrx.uncheckedCast(t.ice_connectionCached(False)) test(not t.ice_isConnectionCached()) @@ -523,7 +541,9 @@ def allTests(helper, communicator): print("ok") - sys.stdout.write("testing per request binding and ordered endpoint selection and AMI... ") + sys.stdout.write( + "testing per request binding and ordered endpoint selection and AMI... " + ) sys.stdout.flush() adapters = [] @@ -532,7 +552,9 @@ def allTests(helper, communicator): adapters.append(com.createObjectAdapter("AdapterAMI63", "default")) t = createTestIntfPrx(adapters) - t = Test.TestIntfPrx.uncheckedCast(t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)) + t = Test.TestIntfPrx.uncheckedCast( + t.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) + ) test(t.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered) t = Test.TestIntfPrx.uncheckedCast(t.ice_connectionCached(False)) test(not t.ice_isConnectionCached()) @@ -612,7 +634,7 @@ def allTests(helper, communicator): print("ok") - if (len(communicator.getProperties().getProperty("Ice.Plugin.IceSSL")) > 0): + if len(communicator.getProperties().getProperty("Ice.Plugin.IceSSL")) > 0: sys.stdout.write("testing unsecure vs. secure endpoints... ") sys.stdout.flush() @@ -639,7 +661,9 @@ def allTests(helper, communicator): test(t.getAdapterName() == "Adapter81") t.ice_getConnection().close(Ice.ConnectionClose.GracefullyWithWait) - com.createObjectAdapter("Adapter83", (t.ice_getEndpoints()[1]).toString()) # Reactive tcp OA. + com.createObjectAdapter( + "Adapter83", (t.ice_getEndpoints()[1]).toString() + ) # Reactive tcp OA. for i in range(0, 5): test(t.getAdapterName() == "Adapter83") diff --git a/python/test/Ice/binding/Client.py b/python/test/Ice/binding/Client.py index da431a0c718..c38c885efcd 100755 --- a/python/test/Ice/binding/Client.py +++ b/python/test/Ice/binding/Client.py @@ -4,13 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/binding/Server.py b/python/test/Ice/binding/Server.py index eca92e43719..b95f6ef8743 100755 --- a/python/test/Ice/binding/Server.py +++ b/python/test/Ice/binding/Server.py @@ -5,19 +5,21 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI class Server(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") - adapter.add(TestI.RemoteCommunicatorI(), Ice.stringToIdentity("communicator")) + adapter.add( + TestI.RemoteCommunicatorI(), Ice.stringToIdentity("communicator") + ) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/binding/TestI.py b/python/test/Ice/binding/TestI.py index 8a358b77a67..d5a06739930 100644 --- a/python/test/Ice/binding/TestI.py +++ b/python/test/Ice/binding/TestI.py @@ -7,21 +7,25 @@ class RemoteCommunicatorI(Test.RemoteCommunicator): - def __init__(self): self._nextPort = 10001 def createObjectAdapter(self, name, endpoints, current=None): self._nextPort += 1 if endpoints.find("-p") < 0: - endpoints += " -h \"{0}\" -p {1}".format( - current.adapter.getCommunicator().getProperties().getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"), - self._nextPort) + endpoints += ' -h "{0}" -p {1}'.format( + current.adapter.getCommunicator() + .getProperties() + .getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"), + self._nextPort, + ) com = current.adapter.getCommunicator() com.getProperties().setProperty(name + ".ThreadPool.Size", "1") adapter = com.createObjectAdapterWithEndpoints(name, endpoints) - return Test.RemoteObjectAdapterPrx.uncheckedCast(current.adapter.addWithUUID(RemoteObjectAdapterI(adapter))) + return Test.RemoteObjectAdapterPrx.uncheckedCast( + current.adapter.addWithUUID(RemoteObjectAdapterI(adapter)) + ) def deactivateObjectAdapter(self, adapter, current=None): adapter.deactivate() @@ -33,7 +37,9 @@ def shutdown(self, current=None): class RemoteObjectAdapterI(Test.RemoteObjectAdapter): def __init__(self, adapter): self._adapter = adapter - self._testIntf = Test.TestIntfPrx.uncheckedCast(self._adapter.add(TestI(), Ice.stringToIdentity("test"))) + self._testIntf = Test.TestIntfPrx.uncheckedCast( + self._adapter.add(TestI(), Ice.stringToIdentity("test")) + ) self._adapter.activate() def getTestIntf(self, current=None): diff --git a/python/test/Ice/blobject/Client.py b/python/test/Ice/blobject/Client.py index f28b664a7fa..59d08a3bcce 100755 --- a/python/test/Ice/blobject/Client.py +++ b/python/test/Ice/blobject/Client.py @@ -4,7 +4,8 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import sys import Ice import Test @@ -13,13 +14,14 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class Client(TestHelper): - def allTests(self, communicator, sync): - hello = Test.HelloPrx.checkedCast(communicator.stringToProxy("test:{0}".format(self.getTestEndpoint()))) + hello = Test.HelloPrx.checkedCast( + communicator.stringToProxy("test:{0}".format(self.getTestEndpoint())) + ) hello.sayHello(False) hello.sayHello(False, {"_fwd": "o"}) test(hello.add(10, 20) == 30) @@ -30,24 +32,29 @@ def allTests(self, communicator, sync): pass try: - Test.HelloPrx.checkedCast(communicator.stringToProxy("unknown:{0} -t 10000".format(self.getTestEndpoint()))) + Test.HelloPrx.checkedCast( + communicator.stringToProxy( + "unknown:{0} -t 10000".format(self.getTestEndpoint()) + ) + ) test(False) except Ice.ObjectNotExistException: pass # First try an object at a non-existent endpoint. try: - Test.HelloPrx.checkedCast(communicator.stringToProxy("missing:default -p 12000 -t 10000")) + Test.HelloPrx.checkedCast( + communicator.stringToProxy("missing:default -p 12000 -t 10000") + ) test(False) except Ice.UnknownLocalException as e: - test(e.unknown.find('ConnectionRefusedException')) + test(e.unknown.find("ConnectionRefusedException")) if sync: hello.shutdown() def run(self, args): - properties = self.createTestProperties(args) - properties.setProperty('Ice.Warn.Dispatch', '0') + properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: router = RouterI.RouterI(communicator, False) sys.stdout.write("testing async blobject... ") diff --git a/python/test/Ice/blobject/RouterI.py b/python/test/Ice/blobject/RouterI.py index 913591f8b12..542e4731ebf 100644 --- a/python/test/Ice/blobject/RouterI.py +++ b/python/test/Ice/blobject/RouterI.py @@ -49,12 +49,19 @@ def execute(self): if "_fwd" in self._curr.ctx and self._curr.ctx["_fwd"] == "o": proxy = proxy.ice_oneway() try: - ok, out = proxy.ice_invoke(self._curr.operation, self._curr.mode, self._inParams, self._curr.ctx) + ok, out = proxy.ice_invoke( + self._curr.operation, + self._curr.mode, + self._inParams, + self._curr.ctx, + ) self._future.set_result((ok, out)) except Ice.Exception as e: self._future.set_exception(e) else: - f = proxy.ice_invokeAsync(self._curr.operation, self._curr.mode, self._inParams, self._curr.ctx) + f = proxy.ice_invokeAsync( + self._curr.operation, self._curr.mode, self._inParams, self._curr.ctx + ) f.add_done_callback(self.done) def done(self, future): @@ -82,7 +89,9 @@ def ice_invoke(self, inParams, curr): def add(self, proxy): with self._lock: - self._objects[proxy.ice_getIdentity()] = proxy.ice_facet("").ice_twoway().ice_router(None) + self._objects[proxy.ice_getIdentity()] = ( + proxy.ice_facet("").ice_twoway().ice_router(None) + ) def destroy(self): with self._lock: @@ -108,12 +117,14 @@ def ice_invoke(self, inParams, curr): return proxy.ice_invoke(curr.operation, curr.mode, inParams, curr.ctx) else: return proxy.ice_invoke(curr.operation, curr.mode, inParams, curr.ctx) - except Ice.Exception as e: + except Ice.Exception: raise def add(self, proxy): with self._lock: - self._objects[proxy.ice_getIdentity()] = proxy.ice_facet("").ice_twoway().ice_router(None) + self._objects[proxy.ice_getIdentity()] = ( + proxy.ice_facet("").ice_twoway().ice_router(None) + ) def destroy(self): pass @@ -135,7 +146,9 @@ def deactivate(self, s): class RouterI(Ice.Router): def __init__(self, communicator, sync): - self._adapter = communicator.createObjectAdapterWithEndpoints("forward", "default -h 127.0.0.1") + self._adapter = communicator.createObjectAdapterWithEndpoints( + "forward", "default -h 127.0.0.1" + ) if sync: self._blobject = BlobjectI() else: @@ -153,7 +166,7 @@ def getClientProxy(self, current): return (self._blobjectProxy, True) def getServerProxy(self, current): - assert (False) + assert False def addProxies(self, proxies, current): for p in proxies: diff --git a/python/test/Ice/blobject/Server.py b/python/test/Ice/blobject/Server.py index 369788ec1a2..2f7f347a3cd 100755 --- a/python/test/Ice/blobject/Server.py +++ b/python/test/Ice/blobject/Server.py @@ -4,7 +4,8 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import Ice import Test import time @@ -26,7 +27,6 @@ def shutdown(self, current=None): class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) # @@ -36,7 +36,9 @@ def run(self, args): # properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/blobject/test.py b/python/test/Ice/blobject/test.py index b2e5338876b..1afce8e7d7c 100644 --- a/python/test/Ice/blobject/test.py +++ b/python/test/Ice/blobject/test.py @@ -6,4 +6,7 @@ # This test doesn't support running with IceSSL, the Router object in the client process uses # the client certificate and fails with "unsupported certificate purpose" +from Util import TestSuite + + TestSuite(__name__, options={"protocol": ["tcp"]}) diff --git a/python/test/Ice/custom/AllTests.py b/python/test/Ice/custom/AllTests.py index eaf0afdd2be..68e06d1e8fb 100644 --- a/python/test/Ice/custom/AllTests.py +++ b/python/test/Ice/custom/AllTests.py @@ -3,9 +3,6 @@ # import sys -import string -import re -import traceback import Ice import Test import array @@ -13,7 +10,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): @@ -26,7 +23,7 @@ def allTests(helper, communicator): byteList = [1, 2, 3, 4, 5] byteString = bytes(byteList) - stringList = ['s1', 's2', 's3'] + stringList = ["s1", "s2", "s3"] sys.stdout.write("testing custom sequences... ") sys.stdout.flush() @@ -356,6 +353,7 @@ def allTests(helper, communicator): try: import numpy + ref = "test.numpy:{0}".format(helper.getTestEndpoint()) base = communicator.stringToProxy(ref) test(base) @@ -490,8 +488,12 @@ def allTests(helper, communicator): d.shortSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 128, 256], numpy.int16) d.intSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 128, 256], numpy.int32) d.longSeq = numpy.array([0, 2, 4, 8, 16, 32, 64, 128, 256], numpy.int64) - d.floatSeq = numpy.array([0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256], numpy.float32) - d.doubleSeq = numpy.array([0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256], numpy.float64) + d.floatSeq = numpy.array( + [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256], numpy.float32 + ) + d.doubleSeq = numpy.array( + [0.1, 0.2, 0.4, 0.8, 0.16, 0.32, 0.64, 0.128, 0.256], numpy.float64 + ) d1 = custom.opD(d) test(isinstance(d1.boolSeq, numpy.ndarray)) @@ -532,10 +534,15 @@ def allTests(helper, communicator): test(d1.floatSeq == Ice.Unset) test(d1.doubleSeq == Ice.Unset) - v1 = numpy.array([numpy.complex128(1 + 1j), - numpy.complex128(2 + 2j), - numpy.complex128(3 + 3j), - numpy.complex128(4 + 4j)], numpy.complex128) + v1 = numpy.array( + [ + numpy.complex128(1 + 1j), + numpy.complex128(2 + 2j), + numpy.complex128(3 + 3j), + numpy.complex128(4 + 4j), + ], + numpy.complex128, + ) v2 = custom.opComplex128Seq(v1) test(isinstance(v2, numpy.ndarray)) test(len(v1) == len(v2)) @@ -548,39 +555,63 @@ def allTests(helper, communicator): test(len(v1) == len(v2)) v1 = custom.opBoolMatrix() - test(numpy.array_equal(v1, numpy.array([[True, False, True], - [True, False, True], - [True, False, True]], numpy.bool_))) + test( + numpy.array_equal( + v1, + numpy.array( + [[True, False, True], [True, False, True], [True, False, True]], + numpy.bool_, + ), + ) + ) v1 = custom.opByteMatrix() - test(numpy.array_equal(v1, numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int8))) + test( + numpy.array_equal( + v1, numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int8) + ) + ) v1 = custom.opShortMatrix() - test(numpy.array_equal(v1, numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int16))) + test( + numpy.array_equal( + v1, numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int16) + ) + ) v1 = custom.opIntMatrix() - test(numpy.array_equal(v1, numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int32))) + test( + numpy.array_equal( + v1, numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int32) + ) + ) v1 = custom.opLongMatrix() - test(numpy.array_equal(v1, numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int64))) + test( + numpy.array_equal( + v1, numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int64) + ) + ) v1 = custom.opFloatMatrix() - test(numpy.array_equal(v1, numpy.array([[1.1, 0.1, 1.1], - [1.1, 0.1, 1.1], - [1.1, 0.1, 1.1]], numpy.float32))) + test( + numpy.array_equal( + v1, + numpy.array( + [[1.1, 0.1, 1.1], [1.1, 0.1, 1.1], [1.1, 0.1, 1.1]], numpy.float32 + ), + ) + ) v1 = custom.opDoubleMatrix() - test(numpy.array_equal(v1, numpy.array([[1.1, 0.1, 1.1], - [1.1, 0.1, 1.1], - [1.1, 0.1, 1.1]], numpy.float64))) + test( + numpy.array_equal( + v1, + numpy.array( + [[1.1, 0.1, 1.1], [1.1, 0.1, 1.1], [1.1, 0.1, 1.1]], numpy.float64 + ), + ) + ) try: custom.opBogusNumpyArrayType() diff --git a/python/test/Ice/custom/Client.py b/python/test/Ice/custom/Client.py index fb1a3a6e5f3..f6b133c686a 100755 --- a/python/test/Ice/custom/Client.py +++ b/python/test/Ice/custom/Client.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") try: @@ -15,7 +16,6 @@ class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: custom = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/custom/Custom.py b/python/test/Ice/custom/Custom.py index fa86599a7bd..26b78df79f1 100644 --- a/python/test/Ice/custom/Custom.py +++ b/python/test/Ice/custom/Custom.py @@ -4,11 +4,10 @@ import Ice -try: - import numpy - hasNumPy = True -except ImportError: - hasNumPy = False + +from importlib.util import find_spec + +hasNumPy = find_spec("numpy") is not None def myBoolSeq(buffer, type, copy): @@ -64,6 +63,7 @@ def myNumPyDoubleSeq(buffer, type, copy): def myNumPyComplex128Seq(buffer, type, copy): import numpy + return numpy.frombuffer(buffer.tobytes() if copy else buffer, numpy.complex128) def myNumPyMatrix3x3(buffer, type, copy): diff --git a/python/test/Ice/custom/Server.py b/python/test/Ice/custom/Server.py index 1a48dd5edeb..2d2cb9bd496 100755 --- a/python/test/Ice/custom/Server.py +++ b/python/test/Ice/custom/Server.py @@ -4,11 +4,13 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") try: import numpy + hasNumPy = True except ImportError: hasNumPy = False @@ -23,7 +25,6 @@ except ImportError: pass -import sys import Test import Ice import array @@ -31,7 +32,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CustomI(Test.Custom): @@ -143,7 +144,6 @@ def shutdown(self, current=None): if hasNumPy: class NumPyCustomI(Test.NumPy.Custom): - def opBoolSeq(self, v1, current): test(isinstance(v1, numpy.ndarray)) return v1, v1 @@ -177,39 +177,32 @@ def opComplex128Seq(self, v1, current): return v1 def opBoolMatrix(self, current): - return numpy.array([[True, False, True], - [True, False, True], - [True, False, True]], numpy.bool_) + return numpy.array( + [[True, False, True], [True, False, True], [True, False, True]], + numpy.bool_, + ) def opByteMatrix(self, current): - return numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int8) + return numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int8) def opShortMatrix(self, current): - return numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int16) + return numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int16) def opIntMatrix(self, current): - return numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int32) + return numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int32) def opLongMatrix(self, current): - return numpy.array([[1, 0, 1], - [1, 0, 1], - [1, 0, 1]], numpy.int64) + return numpy.array([[1, 0, 1], [1, 0, 1], [1, 0, 1]], numpy.int64) def opFloatMatrix(self, current): - return numpy.array([[1.1, 0.1, 1.1], - [1.1, 0.1, 1.1], - [1.1, 0.1, 1.1]], numpy.float32) + return numpy.array( + [[1.1, 0.1, 1.1], [1.1, 0.1, 1.1], [1.1, 0.1, 1.1]], numpy.float32 + ) def opDoubleMatrix(self, current): - return numpy.array([[1.1, 0.1, 1.1], - [1.1, 0.1, 1.1], - [1.1, 0.1, 1.1]], numpy.float64) + return numpy.array( + [[1.1, 0.1, 1.1], [1.1, 0.1, 1.1], [1.1, 0.1, 1.1]], numpy.float64 + ) def opBogusNumpyArrayType(self, current): return [True, False, True, False] @@ -222,10 +215,11 @@ def shutdown(self, current=None): class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(CustomI(), Ice.stringToIdentity("test")) if hasNumPy: diff --git a/python/test/Ice/defaultServant/AllTests.py b/python/test/Ice/defaultServant/AllTests.py index 53423c7e0ca..7fda6d1e6c6 100644 --- a/python/test/Ice/defaultServant/AllTests.py +++ b/python/test/Ice/defaultServant/AllTests.py @@ -10,11 +10,10 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): - oa = communicator.createObjectAdapterWithEndpoints("MyOA", "tcp -h localhost") oa.activate() @@ -31,7 +30,7 @@ def allTests(helper, communicator): test(r == servant) r = oa.findDefaultServant("bar") - test(r == None) + test(r is None) identity = Ice.Identity() identity.category = "foo" @@ -112,7 +111,7 @@ def allTests(helper, communicator): oa.addDefaultServant(servant, "") r = oa.findDefaultServant("bar") - test(r == None) + test(r is None) r = oa.findDefaultServant("") test(r == servant) diff --git a/python/test/Ice/defaultServant/Client.py b/python/test/Ice/defaultServant/Client.py index dc5eb59e999..c38c885efcd 100755 --- a/python/test/Ice/defaultServant/Client.py +++ b/python/test/Ice/defaultServant/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/defaultValue/AllTests.py b/python/test/Ice/defaultValue/AllTests.py index c22b8d4a906..81cb2bf9427 100644 --- a/python/test/Ice/defaultValue/AllTests.py +++ b/python/test/Ice/defaultValue/AllTests.py @@ -2,18 +2,16 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test import sys def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(): - sys.stdout.write("testing default values... ") sys.stdout.flush() @@ -26,14 +24,14 @@ def allTests(): test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) - test(v.str == "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007") + test(v.str == 'foo \\ "bar\n \r\n\t\013\f\007\b? \007 \007') test(v.c1 == Test.Color.red) test(v.c2 == Test.Color.green) test(v.c3 == Test.Color.blue) test(v.nc1 == Test.Nested.Color.red) test(v.nc2 == Test.Nested.Color.green) test(v.nc3 == Test.Nested.Color.blue) - test(v.noDefault == '') + test(v.noDefault == "") test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) @@ -72,8 +70,8 @@ def allTests(): test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) - test(v.str == "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007") - test(v.noDefault == '') + test(v.str == 'foo \\ "bar\n \r\n\t\013\f\007\b? \007 \007') + test(v.noDefault == "") test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) @@ -90,14 +88,14 @@ def allTests(): test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) - test(v.str == "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007") + test(v.str == 'foo \\ "bar\n \r\n\t\013\f\007\b? \007 \007') test(v.c1 == Test.Color.red) test(v.c2 == Test.Color.green) test(v.c3 == Test.Color.blue) test(v.nc1 == Test.Nested.Color.red) test(v.nc2 == Test.Nested.Color.green) test(v.nc3 == Test.Nested.Color.blue) - test(v.noDefault == '') + test(v.noDefault == "") test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) @@ -114,8 +112,8 @@ def allTests(): test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) - test(v.str == "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007") - test(v.noDefault == '') + test(v.str == 'foo \\ "bar\n \r\n\t\013\f\007\b? \007 \007') + test(v.noDefault == "") test(v.zeroI == 0) test(v.zeroL == 0) test(v.zeroF == 0) @@ -132,8 +130,8 @@ def allTests(): test(v.l == 4) test(v.f == 5.1) test(v.d == 6.2) - test(v.str == "foo \\ \"bar\n \r\n\t\013\f\007\b? \007 \007") - test(v.noDefault == '') + test(v.str == 'foo \\ "bar\n \r\n\t\013\f\007\b? \007 \007') + test(v.noDefault == "") test(v.c1 == Test.Color.red) test(v.c2 == Test.Color.green) test(v.c3 == Test.Color.blue) @@ -152,14 +150,14 @@ def allTests(): sys.stdout.write("testing default constructor... ") sys.stdout.flush() v = Test.StructNoDefaults() - test(v.bo == False) + test(v.bo is False) test(v.b == 0) test(v.s == 0) test(v.i == 0) test(v.l == 0) test(v.f == 0.0) test(v.d == 0.0) - test(v.str == '') + test(v.str == "") test(v.c1 == Test.Color.red) test(v.bs is None) test(v.iseq is None) @@ -167,14 +165,14 @@ def allTests(): test(v.dict is None) e = Test.ExceptionNoDefaults() - test(e.str == '') + test(e.str == "") test(e.c1 == Test.Color.red) test(e.bs is None) test(isinstance(e.st, Test.InnerStruct)) test(e.dict is None) c = Test.ClassNoDefaults() - test(c.str == '') + test(c.str == "") test(c.c1 == Test.Color.red) test(c.bs is None) test(isinstance(c.st, Test.InnerStruct)) diff --git a/python/test/Ice/defaultValue/Client.py b/python/test/Ice/defaultValue/Client.py index a1eabd42a54..5fb2773e807 100755 --- a/python/test/Ice/defaultValue/Client.py +++ b/python/test/Ice/defaultValue/Client.py @@ -4,11 +4,11 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): AllTests.allTests() diff --git a/python/test/Ice/dispatcher/AllTests.py b/python/test/Ice/dispatcher/AllTests.py index ba89dfa7061..6125981d69e 100644 --- a/python/test/Ice/dispatcher/AllTests.py +++ b/python/test/Ice/dispatcher/AllTests.py @@ -12,7 +12,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class Callback: diff --git a/python/test/Ice/dispatcher/Client.py b/python/test/Ice/dispatcher/Client.py index 826d78ec2e4..22129e5012d 100755 --- a/python/test/Ice/dispatcher/Client.py +++ b/python/test/Ice/dispatcher/Client.py @@ -6,12 +6,12 @@ import Ice import Dispatcher from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): initData = Ice.InitializationData() initData.properties = self.createTestProperties(args) diff --git a/python/test/Ice/dispatcher/Dispatcher.py b/python/test/Ice/dispatcher/Dispatcher.py index fea1d893bb1..b5b4b9842fb 100755 --- a/python/test/Ice/dispatcher/Dispatcher.py +++ b/python/test/Ice/dispatcher/Dispatcher.py @@ -3,17 +3,12 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice -import os -import sys -import traceback -import time import threading def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class Dispatcher: @@ -46,7 +41,7 @@ def run(self): if call: try: call() - except: + except Exception: # Exceptions should never propagate here. test(False) diff --git a/python/test/Ice/dispatcher/Server.py b/python/test/Ice/dispatcher/Server.py index 48d85e79eb7..7997d4a2162 100755 --- a/python/test/Ice/dispatcher/Server.py +++ b/python/test/Ice/dispatcher/Server.py @@ -5,15 +5,14 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI import Dispatcher class Server(TestHelper): - def run(self, args): - initData = Ice.InitializationData() initData.properties = self.createTestProperties(args) @@ -32,9 +31,15 @@ def run(self, args): initData.dispatcher = d.dispatch with self.initialize(initData=initData) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", self.getTestEndpoint(num=1)) - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1") + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) + communicator.getProperties().setProperty( + "ControllerAdapter.Endpoints", self.getTestEndpoint(num=1) + ) + communicator.getProperties().setProperty( + "ControllerAdapter.ThreadPool.Size", "1" + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter2 = communicator.createObjectAdapter("ControllerAdapter") diff --git a/python/test/Ice/dispatcher/TestI.py b/python/test/Ice/dispatcher/TestI.py index 8463bc336a1..8a48ccce979 100644 --- a/python/test/Ice/dispatcher/TestI.py +++ b/python/test/Ice/dispatcher/TestI.py @@ -2,7 +2,6 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test import Dispatcher import time @@ -10,7 +9,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestIntfI(Test.TestIntf): diff --git a/python/test/Ice/enums/AllTests.py b/python/test/Ice/enums/AllTests.py index 5cabba45404..093a0049d55 100644 --- a/python/test/Ice/enums/AllTests.py +++ b/python/test/Ice/enums/AllTests.py @@ -3,16 +3,12 @@ # import sys -import string -import re -import traceback -import Ice import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): @@ -113,26 +109,57 @@ def allTests(helper, communicator): sys.stdout.write("testing enum operations... ") sys.stdout.flush() - test(proxy.opByte(Test.ByteEnum.benum1) == (Test.ByteEnum.benum1, Test.ByteEnum.benum1)) - test(proxy.opByte(Test.ByteEnum.benum11) == (Test.ByteEnum.benum11, Test.ByteEnum.benum11)) - - test(proxy.opShort(Test.ShortEnum.senum1) == (Test.ShortEnum.senum1, Test.ShortEnum.senum1)) - test(proxy.opShort(Test.ShortEnum.senum11) == (Test.ShortEnum.senum11, Test.ShortEnum.senum11)) + test( + proxy.opByte(Test.ByteEnum.benum1) + == (Test.ByteEnum.benum1, Test.ByteEnum.benum1) + ) + test( + proxy.opByte(Test.ByteEnum.benum11) + == (Test.ByteEnum.benum11, Test.ByteEnum.benum11) + ) + + test( + proxy.opShort(Test.ShortEnum.senum1) + == (Test.ShortEnum.senum1, Test.ShortEnum.senum1) + ) + test( + proxy.opShort(Test.ShortEnum.senum11) + == (Test.ShortEnum.senum11, Test.ShortEnum.senum11) + ) test(proxy.opInt(Test.IntEnum.ienum1) == (Test.IntEnum.ienum1, Test.IntEnum.ienum1)) - test(proxy.opInt(Test.IntEnum.ienum11) == (Test.IntEnum.ienum11, Test.IntEnum.ienum11)) - test(proxy.opInt(Test.IntEnum.ienum12) == (Test.IntEnum.ienum12, Test.IntEnum.ienum12)) - - test(proxy.opSimple(Test.SimpleEnum.green) == (Test.SimpleEnum.green, Test.SimpleEnum.green)) + test( + proxy.opInt(Test.IntEnum.ienum11) + == (Test.IntEnum.ienum11, Test.IntEnum.ienum11) + ) + test( + proxy.opInt(Test.IntEnum.ienum12) + == (Test.IntEnum.ienum12, Test.IntEnum.ienum12) + ) + + test( + proxy.opSimple(Test.SimpleEnum.green) + == (Test.SimpleEnum.green, Test.SimpleEnum.green) + ) print("ok") sys.stdout.write("testing enum sequences operations... ") sys.stdout.flush() - b1 = [Test.ByteEnum.benum1, Test.ByteEnum.benum2, Test.ByteEnum.benum3, Test.ByteEnum.benum4, Test.ByteEnum.benum5, - Test.ByteEnum.benum6, Test.ByteEnum.benum7, Test.ByteEnum.benum8, Test.ByteEnum.benum9, Test.ByteEnum.benum10, - Test.ByteEnum.benum11] + b1 = [ + Test.ByteEnum.benum1, + Test.ByteEnum.benum2, + Test.ByteEnum.benum3, + Test.ByteEnum.benum4, + Test.ByteEnum.benum5, + Test.ByteEnum.benum6, + Test.ByteEnum.benum7, + Test.ByteEnum.benum8, + Test.ByteEnum.benum9, + Test.ByteEnum.benum10, + Test.ByteEnum.benum11, + ] (b2, b3) = proxy.opByteSeq(b1) @@ -140,9 +167,19 @@ def allTests(helper, communicator): test(b1[i] == b2[i]) test(b1[i] == b3[i]) - s1 = [Test.ShortEnum.senum1, Test.ShortEnum.senum2, Test.ShortEnum.senum3, Test.ShortEnum.senum4, - Test.ShortEnum.senum5, Test.ShortEnum.senum6, Test.ShortEnum.senum7, Test.ShortEnum.senum8, - Test.ShortEnum.senum9, Test.ShortEnum.senum10, Test.ShortEnum.senum11] + s1 = [ + Test.ShortEnum.senum1, + Test.ShortEnum.senum2, + Test.ShortEnum.senum3, + Test.ShortEnum.senum4, + Test.ShortEnum.senum5, + Test.ShortEnum.senum6, + Test.ShortEnum.senum7, + Test.ShortEnum.senum8, + Test.ShortEnum.senum9, + Test.ShortEnum.senum10, + Test.ShortEnum.senum11, + ] (s2, s3) = proxy.opShortSeq(s1) @@ -150,9 +187,19 @@ def allTests(helper, communicator): test(s1[i] == s2[i]) test(s1[i] == s3[i]) - i1 = [Test.IntEnum.ienum1, Test.IntEnum.ienum2, Test.IntEnum.ienum3, Test.IntEnum.ienum4, - Test.IntEnum.ienum5, Test.IntEnum.ienum6, Test.IntEnum.ienum7, Test.IntEnum.ienum8, - Test.IntEnum.ienum9, Test.IntEnum.ienum10, Test.IntEnum.ienum11] + i1 = [ + Test.IntEnum.ienum1, + Test.IntEnum.ienum2, + Test.IntEnum.ienum3, + Test.IntEnum.ienum4, + Test.IntEnum.ienum5, + Test.IntEnum.ienum6, + Test.IntEnum.ienum7, + Test.IntEnum.ienum8, + Test.IntEnum.ienum9, + Test.IntEnum.ienum10, + Test.IntEnum.ienum11, + ] (i2, i3) = proxy.opIntSeq(i1) diff --git a/python/test/Ice/enums/Client.py b/python/test/Ice/enums/Client.py index a996713f02b..a84d1b34d94 100755 --- a/python/test/Ice/enums/Client.py +++ b/python/test/Ice/enums/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: proxy = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/enums/Server.py b/python/test/Ice/enums/Server.py index cfcd3ce447b..6b14836e952 100755 --- a/python/test/Ice/enums/Server.py +++ b/python/test/Ice/enums/Server.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import Test @@ -39,11 +40,11 @@ def shutdown(self, current=None): class Server(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestIntfI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/exceptions/AllTests.py b/python/test/Ice/exceptions/AllTests.py index 720cef42f9a..7173dbf32db 100644 --- a/python/test/Ice/exceptions/AllTests.py +++ b/python/test/Ice/exceptions/AllTests.py @@ -11,7 +11,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class EmptyI(Test.Empty): @@ -70,7 +70,7 @@ def exception_AorDasAorD(self, ex): test(ex.aMem == 1) except Test.D as ex: test(ex.dMem == -1) - except: + except Exception: test(False) self.called() @@ -80,7 +80,7 @@ def exception_BasB(self, ex): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: test(False) self.called() @@ -91,7 +91,7 @@ def exception_CasC(self, ex): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: test(False) self.called() @@ -106,7 +106,7 @@ def exception_ModA(self, ex): # This operation is not supported in Java. # pass - except: + except Exception: test(False) self.called() @@ -116,7 +116,7 @@ def exception_BasA(self, ex): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: test(False) self.called() @@ -127,7 +127,7 @@ def exception_CasA(self, ex): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: test(False) self.called() @@ -138,7 +138,7 @@ def exception_CasB(self, ex): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: test(False) self.called() @@ -147,7 +147,7 @@ def exception_UndeclaredA(self, ex): raise ex except Ice.UnknownUserException: pass - except: + except Exception: test(False) self.called() @@ -156,7 +156,7 @@ def exception_UndeclaredB(self, ex): raise ex except Ice.UnknownUserException: pass - except: + except Exception: test(False) self.called() @@ -165,7 +165,7 @@ def exception_UndeclaredC(self, ex): raise ex except Ice.UnknownUserException: pass - except: + except Exception: test(False) self.called() @@ -175,7 +175,7 @@ def exception_AasAObjectNotExist(self, ex): except Ice.ObjectNotExistException as ex: id = Ice.stringToIdentity("does not exist") test(ex.id == id) - except: + except Exception: test(False) self.called() @@ -184,7 +184,7 @@ def exception_AasAFacetNotExist(self, ex): raise ex except Ice.FacetNotExistException as ex: test(ex.facet == "no such facet") - except: + except Exception: test(False) self.called() @@ -193,7 +193,7 @@ def exception_noSuchOperation(self, ex): raise ex except Ice.OperationNotExistException as ex: test(ex.operation == "noSuchOperation") - except: + except Exception: test(False) self.called() @@ -202,9 +202,9 @@ def exception_LocalException(self, ex): raise ex except Ice.UnknownLocalException as ex: pass - except Ice.OperationNotExistException as ex: + except Ice.OperationNotExistException: pass - except: + except Exception: test(False) self.called() @@ -213,7 +213,7 @@ def exception_NonIceException(self, ex): raise ex except Ice.UnknownException as ex: pass - except: + except Exception: test(False) self.called() @@ -301,7 +301,7 @@ def allTests(helper, communicator): test(False) except Test.A as ex: test(ex.aMem == 1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -310,7 +310,7 @@ def allTests(helper, communicator): test(False) except Test.A as ex: test(ex.aMem == 1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -319,7 +319,7 @@ def allTests(helper, communicator): test(False) except Test.D as ex: test(ex.dMem == -1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -329,7 +329,7 @@ def allTests(helper, communicator): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: print(sys.exc_info()) test(False) @@ -340,7 +340,7 @@ def allTests(helper, communicator): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: print(sys.exc_info()) test(False) @@ -355,7 +355,7 @@ def allTests(helper, communicator): # This operation is not supported in Java. # pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -369,7 +369,7 @@ def allTests(helper, communicator): test(False) except Test.A as ex: test(ex.aMem == 1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -379,7 +379,7 @@ def allTests(helper, communicator): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: print(sys.exc_info()) test(False) @@ -393,7 +393,7 @@ def allTests(helper, communicator): # This operation is not supported in Java. # pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -408,7 +408,7 @@ def allTests(helper, communicator): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: print(sys.exc_info()) test(False) @@ -419,7 +419,7 @@ def allTests(helper, communicator): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: print(sys.exc_info()) test(False) @@ -430,7 +430,7 @@ def allTests(helper, communicator): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: print(sys.exc_info()) test(False) @@ -445,7 +445,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownUserException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -454,7 +454,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownUserException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -463,7 +463,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownUserException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -474,11 +474,11 @@ def allTests(helper, communicator): sys.stdout.flush() try: - thrower.throwMemoryLimitException(array.array('B')) + thrower.throwMemoryLimitException(array.array("B")) test(False) except Ice.MemoryLimitException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -489,7 +489,7 @@ def allTests(helper, communicator): pass except Ice.UnknownLocalException: pass - except: + except Exception: test(False) print("ok") @@ -501,11 +501,11 @@ def allTests(helper, communicator): try: thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_identity(id)) thrower2.throwAasA(1) -# thrower2.ice_ping() + # thrower2.ice_ping() test(False) except Ice.ObjectNotExistException as ex: test(ex.id == id) - except: + except Exception: print(sys.exc_info()) test(False) @@ -521,7 +521,7 @@ def allTests(helper, communicator): test(False) except Ice.FacetNotExistException as ex: test(ex.facet == "no such facet") - except: + except Exception: print(sys.exc_info()) test(False) @@ -536,7 +536,7 @@ def allTests(helper, communicator): test(False) except Ice.OperationNotExistException as ex: test(ex.operation == "noSuchOperation") - except: + except Exception: print(sys.exc_info()) test(False) @@ -550,7 +550,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownLocalException: pass - except: + except Exception: print(sys.exc_info()) test(False) try: @@ -560,7 +560,7 @@ def allTests(helper, communicator): pass except Ice.OperationNotExistException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -574,7 +574,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -585,7 +585,7 @@ def allTests(helper, communicator): try: thrower.throwAfterResponse() - except: + except Exception: print(sys.exc_info()) test(False) @@ -594,7 +594,7 @@ def allTests(helper, communicator): test(False) except Test.A: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -608,7 +608,7 @@ def allTests(helper, communicator): test(False) except Test.A as ex: test(ex.aMem == 1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -617,7 +617,7 @@ def allTests(helper, communicator): test(False) except Test.A as ex: test(ex.aMem == 1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -626,7 +626,7 @@ def allTests(helper, communicator): test(False) except Test.D as ex: test(ex.dMem == -1) - except: + except Exception: print(sys.exc_info()) test(False) @@ -636,7 +636,7 @@ def allTests(helper, communicator): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: print(sys.exc_info()) test(False) @@ -647,7 +647,7 @@ def allTests(helper, communicator): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: print(sys.exc_info()) test(False) @@ -662,7 +662,7 @@ def allTests(helper, communicator): # This operation is not supported in Java. # pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -677,7 +677,7 @@ def allTests(helper, communicator): except Test.B as ex: test(ex.aMem == 1) test(ex.bMem == 2) - except: + except Exception: print(sys.exc_info()) test(False) @@ -688,7 +688,7 @@ def allTests(helper, communicator): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: print(sys.exc_info()) test(False) @@ -699,7 +699,7 @@ def allTests(helper, communicator): test(ex.aMem == 1) test(ex.bMem == 2) test(ex.cMem == 3) - except: + except Exception: print(sys.exc_info()) test(False) @@ -714,7 +714,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownUserException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -723,7 +723,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownUserException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -732,7 +732,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownUserException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -745,11 +745,11 @@ def allTests(helper, communicator): try: thrower2 = Test.ThrowerPrx.uncheckedCast(thrower.ice_identity(id)) thrower2.throwAasAAsync(1).result() -# thrower2.ice_ping() + # thrower2.ice_ping() test(False) except Ice.ObjectNotExistException as ex: test(ex.id == id) - except: + except Exception: print(sys.exc_info()) test(False) @@ -765,7 +765,7 @@ def allTests(helper, communicator): test(False) except Ice.FacetNotExistException as ex: test(ex.facet == "no such facet") - except: + except Exception: print(sys.exc_info()) test(False) @@ -780,7 +780,7 @@ def allTests(helper, communicator): test(False) except Ice.OperationNotExistException as ex: test(ex.operation == "noSuchOperation") - except: + except Exception: print(sys.exc_info()) test(False) @@ -794,7 +794,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownLocalException: pass - except: + except Exception: print(sys.exc_info()) test(False) try: @@ -804,7 +804,7 @@ def allTests(helper, communicator): pass except Ice.OperationNotExistException: pass - except: + except Exception: print(sys.exc_info()) test(False) @@ -818,7 +818,7 @@ def allTests(helper, communicator): test(False) except Ice.UnknownException: pass - except: + except Exception: print(sys.exc_info()) test(False) diff --git a/python/test/Ice/exceptions/Client.py b/python/test/Ice/exceptions/Client.py index 00bcca3f843..0ef3100a91b 100755 --- a/python/test/Ice/exceptions/Client.py +++ b/python/test/Ice/exceptions/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.MessageSizeMax", "10") diff --git a/python/test/Ice/exceptions/Collocated.py b/python/test/Ice/exceptions/Collocated.py index c87d8e464c4..b0e168ffbe4 100755 --- a/python/test/Ice/exceptions/Collocated.py +++ b/python/test/Ice/exceptions/Collocated.py @@ -5,20 +5,22 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI import AllTests class Collocated(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.MessageSizeMax", "10") with self.initialize(properties=properties) as communicator: communicator.getProperties().setProperty("Ice.Warn.Dispatch", "0") - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.ThrowerI(), Ice.stringToIdentity("thrower")) # adapter.activate() // Don't activate OA to ensure collocation is used. diff --git a/python/test/Ice/exceptions/Server.py b/python/test/Ice/exceptions/Server.py index b9810a7053b..428bae27464 100755 --- a/python/test/Ice/exceptions/Server.py +++ b/python/test/Ice/exceptions/Server.py @@ -4,13 +4,13 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") @@ -18,11 +18,17 @@ def run(self, args): properties.setProperty("Ice.MessageSizeMax", "10") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint(num=0)) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint(num=0) + ) communicator.getProperties().setProperty("Ice.MessageSizeMax", "10") - communicator.getProperties().setProperty("TestAdapter2.Endpoints", self.getTestEndpoint(num=1)) + communicator.getProperties().setProperty( + "TestAdapter2.Endpoints", self.getTestEndpoint(num=1) + ) communicator.getProperties().setProperty("TestAdapter2.MessageSizeMax", "0") - communicator.getProperties().setProperty("TestAdapter3.Endpoints", self.getTestEndpoint(num=2)) + communicator.getProperties().setProperty( + "TestAdapter3.Endpoints", self.getTestEndpoint(num=2) + ) communicator.getProperties().setProperty("TestAdapter3.MessageSizeMax", "1") adapter = communicator.createObjectAdapter("TestAdapter") diff --git a/python/test/Ice/exceptions/ServerAMD.py b/python/test/Ice/exceptions/ServerAMD.py index 97df8a6a0ce..7e7d3cdeeb9 100755 --- a/python/test/Ice/exceptions/ServerAMD.py +++ b/python/test/Ice/exceptions/ServerAMD.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import Test @@ -145,17 +146,22 @@ def throwMarshalException(self, current): class ServerAMD(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") properties.setProperty("Ice.Warn.Connections", "0") properties.setProperty("Ice.MessageSizeMax", "10") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) - communicator.getProperties().setProperty("TestAdapter2.Endpoints", self.getTestEndpoint(num=1)) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) + communicator.getProperties().setProperty( + "TestAdapter2.Endpoints", self.getTestEndpoint(num=1) + ) communicator.getProperties().setProperty("TestAdapter2.MessageSizeMax", "0") - communicator.getProperties().setProperty("TestAdapter3.Endpoints", self.getTestEndpoint(num=2)) + communicator.getProperties().setProperty( + "TestAdapter3.Endpoints", self.getTestEndpoint(num=2) + ) communicator.getProperties().setProperty("TestAdapter3.MessageSizeMax", "1") adapter = communicator.createObjectAdapter("TestAdapter") diff --git a/python/test/Ice/exceptions/TestI.py b/python/test/Ice/exceptions/TestI.py index 22f3b2642a0..051618847b8 100644 --- a/python/test/Ice/exceptions/TestI.py +++ b/python/test/Ice/exceptions/TestI.py @@ -4,8 +4,6 @@ import Ice import Test -import array -import sys class ThrowerI(Test.Thrower): diff --git a/python/test/Ice/facets/AllTests.py b/python/test/Ice/facets/AllTests.py index 00582037726..a5c65f87549 100644 --- a/python/test/Ice/facets/AllTests.py +++ b/python/test/Ice/facets/AllTests.py @@ -9,7 +9,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class EmptyI(Test.Empty): @@ -17,7 +17,6 @@ class EmptyI(Test.Empty): def allTests(helper, communicator): - sys.stdout.write("testing Ice.Admin.Facets property... ") sys.stdout.flush() test(len(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets")) == 0) @@ -27,13 +26,25 @@ def allTests(helper, communicator): communicator.getProperties().setProperty("Ice.Admin.Facets", "foo\\'bar") facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets") test(len(facetFilter) == 1 and facetFilter[0] == "foo'bar") - communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'") + communicator.getProperties().setProperty( + "Ice.Admin.Facets", "'foo bar' toto 'titi'" + ) facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets") - test(len(facetFilter) == 3 and facetFilter[0] == "foo bar" and facetFilter[1] == "toto" - and facetFilter[2] == "titi") - communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'") + test( + len(facetFilter) == 3 + and facetFilter[0] == "foo bar" + and facetFilter[1] == "toto" + and facetFilter[2] == "titi" + ) + communicator.getProperties().setProperty( + "Ice.Admin.Facets", "'foo bar\\' toto' 'titi'" + ) facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets") - test(len(facetFilter) == 2 and facetFilter[0] == "foo bar' toto" and facetFilter[1] == "titi") + test( + len(facetFilter) == 2 + and facetFilter[0] == "foo bar' toto" + and facetFilter[1] == "titi" + ) # communicator.getProperties().setProperty("Ice.Admin.Facets", "'foo bar' 'toto titi"); # facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); # test(len(facetFilter) == 0); @@ -42,7 +53,9 @@ def allTests(helper, communicator): sys.stdout.write("testing facet registration exceptions... ") sys.stdout.flush() - communicator.getProperties().setProperty("FacetExceptionTestAdapter.Endpoints", "tcp -h *") + communicator.getProperties().setProperty( + "FacetExceptionTestAdapter.Endpoints", "tcp -h *" + ) adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter") obj = EmptyI() adapter.add(obj, Ice.stringToIdentity("d")) @@ -133,7 +146,7 @@ def allTests(helper, communicator): test(df2.ice_getFacet() == "facetABCD") df3 = Test.DPrx.checkedCast(df, "") test(df3.ice_getFacet() == "") - test(Test.DPrx.checkedCast(df, "bogus") == None) + test(Test.DPrx.checkedCast(df, "bogus") is None) print("ok") sys.stdout.write("testing non-facets A, B, C, and D... ") diff --git a/python/test/Ice/facets/Client.py b/python/test/Ice/facets/Client.py index 46974c1d570..422bba0e605 100755 --- a/python/test/Ice/facets/Client.py +++ b/python/test/Ice/facets/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: g = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/facets/Collocated.py b/python/test/Ice/facets/Collocated.py index 0919a8791f7..8f5be8a17b5 100755 --- a/python/test/Ice/facets/Collocated.py +++ b/python/test/Ice/facets/Collocated.py @@ -5,22 +5,25 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI import AllTests class Collocated(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.DI(), Ice.stringToIdentity("d")) adapter.addFacet(TestI.DI(), Ice.stringToIdentity("d"), "facetABCD") adapter.addFacet(TestI.FI(), Ice.stringToIdentity("d"), "facetEF") - adapter.addFacet(TestI.HI(communicator), Ice.stringToIdentity("d"), "facetGH") + adapter.addFacet( + TestI.HI(communicator), Ice.stringToIdentity("d"), "facetGH" + ) # adapter.activate() // Don't activate OA to ensure collocation is used. diff --git a/python/test/Ice/facets/Server.py b/python/test/Ice/facets/Server.py index f3d1ebbd007..e58467174a9 100755 --- a/python/test/Ice/facets/Server.py +++ b/python/test/Ice/facets/Server.py @@ -5,20 +5,24 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.DI(), Ice.stringToIdentity("d")) adapter.addFacet(TestI.DI(), Ice.stringToIdentity("d"), "facetABCD") adapter.addFacet(TestI.FI(), Ice.stringToIdentity("d"), "facetEF") - adapter.addFacet(TestI.HI(communicator), Ice.stringToIdentity("d"), "facetGH") + adapter.addFacet( + TestI.HI(communicator), Ice.stringToIdentity("d"), "facetGH" + ) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/faultTolerance/AllTests.py b/python/test/Ice/faultTolerance/AllTests.py index f3eff3363a5..a2e81800537 100644 --- a/python/test/Ice/faultTolerance/AllTests.py +++ b/python/test/Ice/faultTolerance/AllTests.py @@ -6,13 +6,13 @@ import sys import threading -Ice.loadSlice('Test.ice') +Ice.loadSlice("Test.ice") import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CallbackBase: @@ -37,7 +37,7 @@ def opPidI(self, f): try: self._pid = f.result() self.called() - except: + except Exception: test(False) def opShutdownI(self, f): @@ -138,7 +138,9 @@ def allTests(helper, communicator, ports): print("ok") elif j == 2 or j == 3: if not ami: - sys.stdout.write("aborting server #%d and #%d with idempotent call... " % (i, i + 1)) + sys.stdout.write( + "aborting server #%d and #%d with idempotent call... " % (i, i + 1) + ) sys.stdout.flush() try: obj.idempotentAbort() @@ -148,7 +150,10 @@ def allTests(helper, communicator, ports): except Ice.ConnectFailedException: print("ok") else: - sys.stdout.write("aborting server #%d and #%d with idempotent AMI call... " % (i, i + 1)) + sys.stdout.write( + "aborting server #%d and #%d with idempotent AMI call... " + % (i, i + 1) + ) sys.stdout.flush() cb = Callback() obj.idempotentAbortAsync().add_done_callback(cb.exceptAbortI) @@ -157,7 +162,7 @@ def allTests(helper, communicator, ports): i = i + 1 else: - assert (False) + assert False i = i + 1 j = j + 1 diff --git a/python/test/Ice/faultTolerance/Client.py b/python/test/Ice/faultTolerance/Client.py index 101851bcbb4..c34193a94e1 100755 --- a/python/test/Ice/faultTolerance/Client.py +++ b/python/test/Ice/faultTolerance/Client.py @@ -9,19 +9,17 @@ class Client(TestHelper): - def run(self, args): - properties = self.createTestProperties(args) # # This test aborts servers, so we don't want warnings. # - properties.setProperty('Ice.Warn.Connections', '0') + properties.setProperty("Ice.Warn.Connections", "0") ports = [] for arg in args: - if arg[0] == '-': + if arg[0] == "-": continue ports.append(int(arg)) diff --git a/python/test/Ice/faultTolerance/Server.py b/python/test/Ice/faultTolerance/Server.py index 8caa2e6d4d3..393b109cad7 100755 --- a/python/test/Ice/faultTolerance/Server.py +++ b/python/test/Ice/faultTolerance/Server.py @@ -6,12 +6,12 @@ import os import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Test class TestI(Test.TestIntf): - def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -27,7 +27,6 @@ def pid(self, current=None): class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) # @@ -39,8 +38,7 @@ def run(self, args): port = 0 for arg in args: - - if arg[0] == '-': + if arg[0] == "-": continue if port > 0: @@ -52,7 +50,9 @@ def run(self, args): raise RuntimeError("no port specified\n") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint(num=port)) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint(num=port) + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/info/AllTests.py b/python/test/Ice/info/AllTests.py index 9dc21fe8efb..df261122a4b 100644 --- a/python/test/Ice/info/AllTests.py +++ b/python/test/Ice/info/AllTests.py @@ -5,23 +5,22 @@ import Ice import Test import sys -import threading def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def getTCPEndpointInfo(info): - while (info): + while info: if isinstance(info, Ice.TCPEndpointInfo): return info info = info.underlying def getTCPConnectionInfo(info): - while (info): + while info: if isinstance(info, Ice.TCPConnectionInfo): return info info = info.underlying @@ -31,9 +30,11 @@ def allTests(helper, communicator): sys.stdout.write("testing proxy endpoint information... ") sys.stdout.flush() - p1 = communicator.stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" + - "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" + - "opaque -e 1.8 -t 100 -v ABCD") + p1 = communicator.stringToProxy( + "test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:" + + "udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:" + + "opaque -e 1.8 -t 100 -v ABCD" + ) endps = p1.ice_getEndpoints() @@ -46,14 +47,30 @@ def allTests(helper, communicator): test(tcpEndpoint.timeout == 1200) test(tcpEndpoint.compress) test(not tcpEndpoint.datagram()) - test((tcpEndpoint.type() == Ice.TCPEndpointType and not tcpEndpoint.secure()) or - (tcpEndpoint.type() == Ice.SSLEndpointType and tcpEndpoint.secure()) or # SSL - (tcpEndpoint.type() == Ice.WSEndpointType and not tcpEndpoint.secure()) or # WS - (tcpEndpoint.type() == Ice.WSSEndpointType and tcpEndpoint.secure())) # WS - test((tcpEndpoint.type() == Ice.TCPEndpointType and isinstance(endpoint, Ice.TCPEndpointInfo)) or - (tcpEndpoint.type() == Ice.SSLEndpointType and isinstance(endpoint, Ice.SSLEndpointInfo)) or - (tcpEndpoint.type() == Ice.WSEndpointType and isinstance(endpoint, Ice.WSEndpointInfo)) or - (tcpEndpoint.type() == Ice.WSSEndpointType and isinstance(endpoint, Ice.WSEndpointInfo))) + test( + (tcpEndpoint.type() == Ice.TCPEndpointType and not tcpEndpoint.secure()) + or (tcpEndpoint.type() == Ice.SSLEndpointType and tcpEndpoint.secure()) # SSL + or (tcpEndpoint.type() == Ice.WSEndpointType and not tcpEndpoint.secure()) # WS + or (tcpEndpoint.type() == Ice.WSSEndpointType and tcpEndpoint.secure()) + ) # WS + test( + ( + tcpEndpoint.type() == Ice.TCPEndpointType + and isinstance(endpoint, Ice.TCPEndpointInfo) + ) + or ( + tcpEndpoint.type() == Ice.SSLEndpointType + and isinstance(endpoint, Ice.SSLEndpointInfo) + ) + or ( + tcpEndpoint.type() == Ice.WSEndpointType + and isinstance(endpoint, Ice.WSEndpointInfo) + ) + or ( + tcpEndpoint.type() == Ice.WSSEndpointType + and isinstance(endpoint, Ice.WSEndpointInfo) + ) + ) udpEndpoint = endps[1].getInfo() test(isinstance(udpEndpoint, Ice.UDPEndpointInfo)) @@ -77,9 +94,14 @@ def allTests(helper, communicator): sys.stdout.write("test object adapter endpoint information... ") sys.stdout.flush() - host = "::1" if communicator.getProperties().getPropertyAsInt("Ice.IPv6") != 0 else "127.0.0.1" - communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -h \"" + host + - "\" -t 15000:udp -h \"" + host + "\"") + host = ( + "::1" + if communicator.getProperties().getPropertyAsInt("Ice.IPv6") != 0 + else "127.0.0.1" + ) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", 'tcp -h "' + host + '" -t 15000:udp -h "' + host + '"' + ) adapter = communicator.createObjectAdapter("TestAdapter") endpoints = adapter.getEndpoints() test(len(endpoints) == 2) @@ -87,8 +109,12 @@ def allTests(helper, communicator): test(endpoints == publishedEndpoints) tcpEndpoint = getTCPEndpointInfo(endpoints[0].getInfo()) - test(tcpEndpoint.type() == Ice.TCPEndpointType or tcpEndpoint.type() == 2 or tcpEndpoint.type() == 4 or - tcpEndpoint.type() == 5) + test( + tcpEndpoint.type() == Ice.TCPEndpointType + or tcpEndpoint.type() == 2 + or tcpEndpoint.type() == 4 + or tcpEndpoint.type() == 5 + ) test(tcpEndpoint.host == host) test(tcpEndpoint.port > 0) test(tcpEndpoint.timeout == 15000) @@ -98,7 +124,7 @@ def allTests(helper, communicator): test(udpEndpoint.datagram()) test(udpEndpoint.port > 0) - endpoints = (endpoints[0], ) + endpoints = (endpoints[0],) test(len(endpoints) == 1) adapter.setPublishedEndpoints(endpoints) publishedEndpoints = adapter.getPublishedEndpoints() @@ -106,8 +132,12 @@ def allTests(helper, communicator): adapter.destroy() - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -h * -p 15000") - communicator.getProperties().setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 15000") + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", "default -h * -p 15000" + ) + communicator.getProperties().setProperty( + "TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 15000" + ) adapter = communicator.createObjectAdapter("TestAdapter") endpoints = adapter.getEndpoints() @@ -128,8 +158,11 @@ def allTests(helper, communicator): print("ok") - base = communicator.stringToProxy("test:{0}:{1}".format(helper.getTestEndpoint(), - helper.getTestEndpoint(protocol="udp"))) + base = communicator.stringToProxy( + "test:{0}:{1}".format( + helper.getTestEndpoint(), helper.getTestEndpoint(protocol="udp") + ) + ) testIntf = Test.TestIntfPrx.checkedCast(base) sys.stdout.write("test connection endpoint information... ") @@ -166,7 +199,7 @@ def allTests(helper, communicator): test(not info.incoming) test(len(info.adapterName) == 0) test(tcpinfo.remotePort == port) - if defaultHost == '127.0.0.1': + if defaultHost == "127.0.0.1": test(tcpinfo.remoteAddress == defaultHost) test(tcpinfo.localAddress == defaultHost) test(tcpinfo.rcvSize >= 1024) @@ -180,7 +213,10 @@ def allTests(helper, communicator): test(ctx["remotePort"] == str(tcpinfo.localPort)) test(ctx["localPort"] == str(tcpinfo.remotePort)) - if (base.ice_getConnection().type() == "ws" or base.ice_getConnection().type() == "wss"): + if ( + base.ice_getConnection().type() == "ws" + or base.ice_getConnection().type() == "wss" + ): test(isinstance(info, Ice.WSConnectionInfo)) test(info.headers["Upgrade"] == "websocket") diff --git a/python/test/Ice/info/Client.py b/python/test/Ice/info/Client.py index dc5eb59e999..c38c885efcd 100755 --- a/python/test/Ice/info/Client.py +++ b/python/test/Ice/info/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/info/Server.py b/python/test/Ice/info/Server.py index cee5d9ce43c..65047151ca9 100755 --- a/python/test/Ice/info/Server.py +++ b/python/test/Ice/info/Server.py @@ -4,19 +4,21 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI class Server(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: communicator.getProperties().setProperty( - "TestAdapter.Endpoints", "{0}:{1}".format(self.getTestEndpoint(), - self.getTestEndpoint(protocol="udp"))) + "TestAdapter.Endpoints", + "{0}:{1}".format( + self.getTestEndpoint(), self.getTestEndpoint(protocol="udp") + ), + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/info/TestI.py b/python/test/Ice/info/TestI.py index f5c2371f53f..6a894478b60 100644 --- a/python/test/Ice/info/TestI.py +++ b/python/test/Ice/info/TestI.py @@ -4,18 +4,17 @@ import Ice import Test -import time def getIPEndpointInfo(info): - while (info): + while info: if isinstance(info, Ice.IPEndpointInfo): return info info = info.underlying def getIPConnectionInfo(info): - while (info): + while info: if isinstance(info, Ice.IPConnectionInfo): return info info = info.underlying diff --git a/python/test/Ice/inheritance/AllTests.py b/python/test/Ice/inheritance/AllTests.py index b3b05680e23..4f81ffe1275 100644 --- a/python/test/Ice/inheritance/AllTests.py +++ b/python/test/Ice/inheritance/AllTests.py @@ -2,14 +2,13 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test import sys def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): diff --git a/python/test/Ice/inheritance/Client.py b/python/test/Ice/inheritance/Client.py index b8c7b1a0a08..94267852a14 100755 --- a/python/test/Ice/inheritance/Client.py +++ b/python/test/Ice/inheritance/Client.py @@ -4,14 +4,13 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: initial = AllTests.allTests(self, communicator) initial.shutdown() diff --git a/python/test/Ice/inheritance/Collocated.py b/python/test/Ice/inheritance/Collocated.py index f2cefd32f43..cd728d66af2 100755 --- a/python/test/Ice/inheritance/Collocated.py +++ b/python/test/Ice/inheritance/Collocated.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI @@ -11,10 +12,11 @@ class Collocated(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.InitialI(adapter), Ice.stringToIdentity("initial")) # adapter.activate() // Don't activate OA to ensure collocation is used. diff --git a/python/test/Ice/inheritance/Server.py b/python/test/Ice/inheritance/Server.py index 83b5f1a60c8..6c87d593d95 100755 --- a/python/test/Ice/inheritance/Server.py +++ b/python/test/Ice/inheritance/Server.py @@ -4,17 +4,18 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import TestI import Ice class Server(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.InitialI(adapter), Ice.stringToIdentity("initial")) adapter.activate() diff --git a/python/test/Ice/inheritance/TestI.py b/python/test/Ice/inheritance/TestI.py index f6e2fce75c0..ee77f1f682c 100644 --- a/python/test/Ice/inheritance/TestI.py +++ b/python/test/Ice/inheritance/TestI.py @@ -2,7 +2,6 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test diff --git a/python/test/Ice/location/AllTests.py b/python/test/Ice/location/AllTests.py index 769a8bfb0e1..0c746d0a6c1 100644 --- a/python/test/Ice/location/AllTests.py +++ b/python/test/Ice/location/AllTests.py @@ -14,7 +14,7 @@ def sayHello(self, current=None): def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): @@ -37,8 +37,12 @@ def allTests(helper, communicator): sys.stdout.write("testing ice_locator and ice_getLocator... ") sys.stdout.flush() - test(Ice.proxyIdentityEqual(base.ice_getLocator(), communicator.getDefaultLocator())) - anotherLocator = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("anotherLocator")) + test( + Ice.proxyIdentityEqual(base.ice_getLocator(), communicator.getDefaultLocator()) + ) + anotherLocator = Ice.LocatorPrx.uncheckedCast( + communicator.stringToProxy("anotherLocator") + ) base = base.ice_locator(anotherLocator) test(Ice.proxyIdentityEqual(base.ice_getLocator(), anotherLocator)) communicator.setDefaultLocator(None) @@ -48,14 +52,18 @@ def allTests(helper, communicator): test(Ice.proxyIdentityEqual(base.ice_getLocator(), anotherLocator)) communicator.setDefaultLocator(locator) base = communicator.stringToProxy("test @ TestAdapter") - test(Ice.proxyIdentityEqual(base.ice_getLocator(), communicator.getDefaultLocator())) + test( + Ice.proxyIdentityEqual(base.ice_getLocator(), communicator.getDefaultLocator()) + ) # # We also test ice_router/ice_getRouter (perhaps we should add a # test/Ice/router test?) # test(not base.ice_getRouter()) - anotherRouter = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("anotherRouter")) + anotherRouter = Ice.RouterPrx.uncheckedCast( + communicator.stringToProxy("anotherRouter") + ) base = base.ice_router(anotherRouter) test(Ice.proxyIdentityEqual(base.ice_getRouter(), anotherRouter)) router = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("dummyrouter")) @@ -76,8 +84,12 @@ def allTests(helper, communicator): sys.stdout.flush() obj = Test.TestIntfPrx.checkedCast(base) obj = Test.TestIntfPrx.checkedCast(communicator.stringToProxy("test@TestAdapter")) - obj = Test.TestIntfPrx.checkedCast(communicator.stringToProxy("test @TestAdapter")) - obj = Test.TestIntfPrx.checkedCast(communicator.stringToProxy("test@ TestAdapter")) + obj = Test.TestIntfPrx.checkedCast( + communicator.stringToProxy("test @TestAdapter") + ) + obj = Test.TestIntfPrx.checkedCast( + communicator.stringToProxy("test@ TestAdapter") + ) test(obj) obj2 = Test.TestIntfPrx.checkedCast(base2) test(obj2) @@ -242,7 +254,9 @@ def allTests(helper, communicator): id.name = Ice.generateUUID() adapter.add(HelloI(), id) - helloPrx = Test.HelloPrx.checkedCast(communicator.stringToProxy(Ice.identityToString(id))) + helloPrx = Test.HelloPrx.checkedCast( + communicator.stringToProxy(Ice.identityToString(id)) + ) test(not helloPrx.ice_getConnection()) helloPrx = Test.HelloPrx.checkedCast(adapter.createIndirectProxy(id)) diff --git a/python/test/Ice/location/Client.py b/python/test/Ice/location/Client.py index 111d5945d3d..93caa9a6430 100755 --- a/python/test/Ice/location/Client.py +++ b/python/test/Ice/location/Client.py @@ -4,14 +4,17 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) - properties.setProperty("Ice.Default.Locator", "locator:{0}".format(self.getTestEndpoint(properties=properties))) + properties.setProperty( + "Ice.Default.Locator", + "locator:{0}".format(self.getTestEndpoint(properties=properties)), + ) with self.initialize(properties=properties) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/location/Server.py b/python/test/Ice/location/Server.py index 8c84e9c8925..4c10efd062c 100755 --- a/python/test/Ice/location/Server.py +++ b/python/test/Ice/location/Server.py @@ -5,6 +5,7 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Test @@ -48,7 +49,6 @@ def getObject(self, id): class ServerLocator(Test.TestLocator): - def __init__(self, registry, registryPrx): self._registry = registry self._registryPrx = registryPrx @@ -77,11 +77,12 @@ def __init__(self, registry, initData, helper): self._nextPort = 1 self._helper = helper self._initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter") - self._initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter") + self._initData.properties.setProperty( + "TestAdapter.ReplicaGroupId", "ReplicatedAdapter" + ) self._initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2") def startServer(self, current=None): - # # Simulate a server: create a new communicator and object # adapter. The object adapter is started on a system allocated @@ -98,23 +99,33 @@ def startServer(self, current=None): adapter = None adapter2 = None try: - serverCommunicator.getProperties().setProperty("TestAdapter.Endpoints", - self._helper.getTestEndpoint(num=self._nextPort)) + serverCommunicator.getProperties().setProperty( + "TestAdapter.Endpoints", + self._helper.getTestEndpoint(num=self._nextPort), + ) self._nextPort += 1 - serverCommunicator.getProperties().setProperty("TestAdapter2.Endpoints", - self._helper.getTestEndpoint(num=self._nextPort)) + serverCommunicator.getProperties().setProperty( + "TestAdapter2.Endpoints", + self._helper.getTestEndpoint(num=self._nextPort), + ) self._nextPort += 1 adapter = serverCommunicator.createObjectAdapter("TestAdapter") adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2") - locator = serverCommunicator.stringToProxy("locator:{0}".format(self._helper.getTestEndpoint())) + locator = serverCommunicator.stringToProxy( + "locator:{0}".format(self._helper.getTestEndpoint()) + ) adapter.setLocator(Ice.LocatorPrx.uncheckedCast(locator)) adapter2.setLocator(Ice.LocatorPrx.uncheckedCast(locator)) object = TestI(adapter, adapter2, self._registry) - self._registry.addObject(adapter.add(object, Ice.stringToIdentity("test"))) - self._registry.addObject(adapter.add(object, Ice.stringToIdentity("test2"))) + self._registry.addObject( + adapter.add(object, Ice.stringToIdentity("test")) + ) + self._registry.addObject( + adapter.add(object, Ice.stringToIdentity("test2")) + ) adapter.add(object, Ice.stringToIdentity("test3")) adapter.activate() @@ -147,16 +158,22 @@ def __init__(self, adapter, adapter2, registry): self._adapter1 = adapter self._adapter2 = adapter2 self._registry = registry - self._registry.addObject(self._adapter1.add(HelloI(), Ice.stringToIdentity("hello"))) + self._registry.addObject( + self._adapter1.add(HelloI(), Ice.stringToIdentity("hello")) + ) def shutdown(self, current=None): self._adapter1.getCommunicator().shutdown() def getHello(self, current=None): - return Test.HelloPrx.uncheckedCast(self._adapter1.createIndirectProxy(Ice.stringToIdentity("hello"))) + return Test.HelloPrx.uncheckedCast( + self._adapter1.createIndirectProxy(Ice.stringToIdentity("hello")) + ) def getReplicatedHello(self, current=None): - return Test.HelloPrx.uncheckedCast(self._adapter1.createProxy(Ice.stringToIdentity("hello"))) + return Test.HelloPrx.uncheckedCast( + self._adapter1.createProxy(Ice.stringToIdentity("hello")) + ) def migrateHello(self, current=None): id = Ice.stringToIdentity("hello") @@ -167,9 +184,7 @@ def migrateHello(self, current=None): class Server(TestHelper): - def run(self, args): - initData = Ice.InitializationData() initData.properties = self.createTestProperties(args) @@ -180,7 +195,9 @@ def run(self, args): # communicator and object adapter). # communicator.getProperties().setProperty("Ice.ThreadPool.Server.Size", "2") - communicator.getProperties().setProperty("ServerManager.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "ServerManager.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("ServerManager") @@ -190,10 +207,17 @@ def run(self, args): # 'servers' created with the server manager interface. # registry = ServerLocatorRegistry() - registry.addObject(adapter.createProxy(Ice.stringToIdentity("ServerManager"))) - adapter.add(ServerManagerI(registry, initData, self), Ice.stringToIdentity("ServerManager")) - - registryPrx = Ice.LocatorRegistryPrx.uncheckedCast(adapter.add(registry, Ice.stringToIdentity("registry"))) + registry.addObject( + adapter.createProxy(Ice.stringToIdentity("ServerManager")) + ) + adapter.add( + ServerManagerI(registry, initData, self), + Ice.stringToIdentity("ServerManager"), + ) + + registryPrx = Ice.LocatorRegistryPrx.uncheckedCast( + adapter.add(registry, Ice.stringToIdentity("registry")) + ) locator = ServerLocator(registry, registryPrx) adapter.add(locator, Ice.stringToIdentity("locator")) diff --git a/python/test/Ice/objects/AllTests.py b/python/test/Ice/objects/AllTests.py index 0d6f099c8c3..f202fd75e6c 100644 --- a/python/test/Ice/objects/AllTests.py +++ b/python/test/Ice/objects/AllTests.py @@ -9,36 +9,36 @@ def MyValueFactory(type): - if type == '::Test::B': + if type == "::Test::B": return TestI.BI() - elif type == '::Test::C': + elif type == "::Test::C": return TestI.CI() - elif type == '::Test::D': + elif type == "::Test::D": return TestI.DI() - elif type == '::Test::E': + elif type == "::Test::E": return TestI.EI() - elif type == '::Test::F': + elif type == "::Test::F": return TestI.FI() - elif type == '::Test::I': + elif type == "::Test::I": return TestI.II() - elif type == '::Test::J': + elif type == "::Test::J": return TestI.JI() - assert (False) # Should never be reached + assert False # Should never be reached def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::B') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::C') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::D') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::E') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::F') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::I') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::J') + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::B") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::C") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::D") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::E") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::F") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::I") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::J") sys.stdout.write("testing stringToProxy... ") sys.stdout.flush() @@ -114,7 +114,9 @@ def allTests(helper, communicator): sys.stdout.write("getting D1... ") sys.stdout.flush() - d1 = initial.getD1(Test.D1(Test.A1("a1"), Test.A1("a2"), Test.A1("a3"), Test.A1("a4"))) + d1 = initial.getD1( + Test.D1(Test.A1("a1"), Test.A1("a2"), Test.A1("a3"), Test.A1("a4")) + ) test(d1.a1.name == "a1") test(d1.a2.name == "a2") test(d1.a3.name == "a3") @@ -150,7 +152,7 @@ def allTests(helper, communicator): test(b2 != d) test(c != d) test(b1.theB == b1) - test(b1.theC == None) + test(b1.theC is None) test(isinstance(b1.theA, Test.B)) test(b1.theA.theA == b1.theA) test(b1.theA.theB == b1) @@ -164,7 +166,7 @@ def allTests(helper, communicator): test(b1.theA.theC.postUnmarshalInvoked) # More tests possible for b2 and d, but I think this is already sufficient. test(b2.theA == b2) - test(d.theC == None) + test(d.theC is None) print("ok") sys.stdout.write("getting B1, B2, C, and D all at once... ") @@ -186,14 +188,14 @@ def allTests(helper, communicator): test(c != d) test(b1.theA == b2) test(b1.theB == b1) - test(b1.theC == None) + test(b1.theC is None) test(b2.theA == b2) test(b2.theB == b1) test(b2.theC == c) test(c.theB == b2) test(d.theA == b1) test(d.theB == b2) - test(d.theC == None) + test(d.theC is None) test(d.preMarshalInvoked) test(d.postUnmarshalInvoked) test(d.theA.preMarshalInvoked) @@ -224,10 +226,12 @@ def allTests(helper, communicator): while depth <= 700: p.v = Test.Recursive() p = p.v - if (depth < 10 and (depth % 10) == 0) or \ - (depth < 1000 and (depth % 100) == 0) or \ - (depth < 10000 and (depth % 1000) == 0) or \ - (depth % 10000) == 0: + if ( + (depth < 10 and (depth % 10) == 0) + or (depth < 1000 and (depth % 100) == 0) + or (depth < 10000 and (depth % 1000) == 0) + or (depth % 10000) == 0 + ): initial.setRecursive(top) depth += 1 test(not initial.supportsClassGraphDepthMax()) @@ -252,9 +256,9 @@ def allTests(helper, communicator): sys.stdout.write("testing marshaled results...") sys.stdout.flush() b1 = initial.getMB() - test(b1 != None and b1.theB == b1) + test(b1 is not None and b1.theB == b1) b1 = initial.getAMDMBAsync().result() - test(b1 != None and b1.theB == b1) + test(b1 is not None and b1.theB == b1) print("ok") # Don't run this test with collocation, this should work with collocation @@ -277,7 +281,7 @@ def allTests(helper, communicator): except Ice.Exception as ex: print(ex) test(False) - except: + except Exception: print(sys.exc_info()) test(False) print("ok") diff --git a/python/test/Ice/objects/Client.py b/python/test/Ice/objects/Client.py index d1eaff805f3..367f310fc19 100755 --- a/python/test/Ice/objects/Client.py +++ b/python/test/Ice/objects/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice Forward.ice ClientPrivate.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: initial = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/objects/Collocated.py b/python/test/Ice/objects/Collocated.py index 2c656251c8e..815c95e11dd 100755 --- a/python/test/Ice/objects/Collocated.py +++ b/python/test/Ice/objects/Collocated.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice Forward.ice ClientPrivate.ice") import Ice import TestI @@ -11,17 +12,20 @@ class Collocated(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") initial = TestI.InitialI(adapter) adapter.add(initial, Ice.stringToIdentity("initial")) adapter.add(TestI.F2I(), Ice.stringToIdentity("F21")) - adapter.add(TestI.UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet")) + adapter.add( + TestI.UnexpectedObjectExceptionTestI(), Ice.stringToIdentity("uoet") + ) # adapter.activate() // Don't activate OA to ensure collocation is used. AllTests.allTests(self, communicator) # We must call shutdown even in the collocated case for cyclic dependency cleanup diff --git a/python/test/Ice/objects/Server.py b/python/test/Ice/objects/Server.py index e81ca98ad16..e95dbb729d4 100755 --- a/python/test/Ice/objects/Server.py +++ b/python/test/Ice/objects/Server.py @@ -4,31 +4,33 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice Forward.ice ServerPrivate.ice") import TestI import Ice def MyValueFactory(type): - if type == '::Test::I': + if type == "::Test::I": return TestI.II() - elif type == '::Test::J': + elif type == "::Test::J": return TestI.JI() - elif type == '::Test::H': + elif type == "::Test::H": return TestI.HI() - assert (False) # Should never be reached + assert False # Should never be reached class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::I') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::J') - communicator.getValueFactoryManager().add(MyValueFactory, '::Test::H') - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::I") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::J") + communicator.getValueFactoryManager().add(MyValueFactory, "::Test::H") + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") initial = TestI.InitialI(adapter) adapter.add(initial, Ice.stringToIdentity("initial")) diff --git a/python/test/Ice/objects/TestI.py b/python/test/Ice/objects/TestI.py index 70114e05c64..c08591c3afa 100644 --- a/python/test/Ice/objects/TestI.py +++ b/python/test/Ice/objects/TestI.py @@ -55,7 +55,7 @@ def __init__(self, e=None): Test.F.__init__(self, e, e) def checkValues(self, current=None): - return self._e1 != None and self._e1 == self.e2 + return self._e1 is not None and self._e1 == self.e2 class II(Ice.InterfaceByValue): @@ -80,7 +80,7 @@ def __init__(self, adapter): self._b1.theA = self._b2 # Cyclic reference to another B self._b1.theB = self._b1 # Self reference. - self._b1.theC = None # Null reference. + self._b1.theC = None # Null reference. self._b2.theA = self._b2 # Self reference, using base. self._b2.theB = self._b1 # Cyclic reference to another B @@ -90,7 +90,7 @@ def __init__(self, adapter): self._d.theA = self._b1 # Reference to a B. self._d.theB = self._b2 # Reference to a B. - self._d.theC = None # Reference to a C. + self._d.theC = None # Reference to a C. def shutdown(self, current=None): self._adapter.getCommunicator().shutdown() @@ -142,7 +142,9 @@ def getMB(self, current): return Test.Initial.GetMBMarshaledResult(self._b1, current) def getAMDMB(self, current): - return Ice.Future.completed(Test.Initial.GetAMDMBMarshaledResult(self._b1, current)) + return Ice.Future.completed( + Test.Initial.GetAMDMBMarshaledResult(self._b1, current) + ) def getAll(self, current=None): self._b1.preMarshalInvoked = False @@ -197,11 +199,23 @@ def opF1(self, f11, current=None): return (f11, Test.F1("F12")) def opF2(self, f21, current=None): - return (f21, Test.F2Prx.uncheckedCast(current.adapter.getCommunicator().stringToProxy("F22"))) + return ( + f21, + Test.F2Prx.uncheckedCast( + current.adapter.getCommunicator().stringToProxy("F22") + ), + ) def opF3(self, f31, current): - return (f31, Test.F3(Test.F1("F12"), - Test.F2Prx.uncheckedCast(current.adapter.getCommunicator().stringToProxy("F22")))) + return ( + f31, + Test.F3( + Test.F1("F12"), + Test.F2Prx.uncheckedCast( + current.adapter.getCommunicator().stringToProxy("F22") + ), + ), + ) def hasF3(self, current): return True diff --git a/python/test/Ice/operations/AllTests.py b/python/test/Ice/operations/AllTests.py index cf77ad99aa7..af8141e11f7 100644 --- a/python/test/Ice/operations/AllTests.py +++ b/python/test/Ice/operations/AllTests.py @@ -15,7 +15,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): diff --git a/python/test/Ice/operations/BatchOneways.py b/python/test/Ice/operations/BatchOneways.py index 28fee177285..7e4b0fd15fa 100644 --- a/python/test/Ice/operations/BatchOneways.py +++ b/python/test/Ice/operations/BatchOneways.py @@ -4,18 +4,15 @@ import Ice import Test -import array -import sys import time def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class BatchRequestInterceptorI(Ice.BatchRequestInterceptor): - def __init__(self): self._enabled = False self._count = 0 @@ -23,7 +20,10 @@ def __init__(self): self._lastRequestSize = 0 def enqueue(self, request, count, size): - test(request.getOperation() == "opByteSOneway" or request.getOperation() == "ice_ping") + test( + request.getOperation() == "opByteSOneway" + or request.getOperation() == "ice_ping" + ) test(request.getProxy().ice_isBatchOneway()) if count > 0: @@ -50,7 +50,6 @@ def count(self): def batchOneways(p): - bs1 = bytes([0 for x in range(0, 10 * 1024)]) try: @@ -115,7 +114,9 @@ def batchOneways(p): ic = Ice.initialize(data=initData) - batch = Test.MyClassPrx.uncheckedCast(ic.stringToProxy(p.ice_toString())).ice_batchOneway() + batch = Test.MyClassPrx.uncheckedCast( + ic.stringToProxy(p.ice_toString()) + ).ice_batchOneway() test(interceptor.count() == 0) batch.ice_ping() diff --git a/python/test/Ice/operations/BatchOnewaysFuture.py b/python/test/Ice/operations/BatchOnewaysFuture.py index 186d667187a..b558c596694 100644 --- a/python/test/Ice/operations/BatchOnewaysFuture.py +++ b/python/test/Ice/operations/BatchOnewaysFuture.py @@ -4,15 +4,13 @@ import Ice import Test -import array -import sys import threading import time def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class Callback: @@ -33,7 +31,6 @@ def called(self): def batchOneways(p): - bs1 = bytes([0 for x in range(0, 10 * 1024)]) batch = Test.MyClassPrx.uncheckedCast(p.ice_batchOneway()) @@ -53,7 +50,6 @@ def batchOneways(p): time.sleep(0.01) if p.ice_getConnection(): - batch1 = Test.MyClassPrx.uncheckedCast(p.ice_batchOneway()) batch2 = Test.MyClassPrx.uncheckedCast(p.ice_batchOneway()) diff --git a/python/test/Ice/operations/Client.py b/python/test/Ice/operations/Client.py index be7617243a3..7fe9b161006 100755 --- a/python/test/Ice/operations/Client.py +++ b/python/test/Ice/operations/Client.py @@ -4,16 +4,16 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) - properties.setProperty('Ice.ThreadPool.Client.Size', '2') - properties.setProperty('Ice.ThreadPool.Client.SizeWarn', '0') + properties.setProperty("Ice.ThreadPool.Client.Size", "2") + properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0") properties.setProperty("Ice.BatchAutoFlushSize", "100") with self.initialize(properties=properties) as communicator: diff --git a/python/test/Ice/operations/Collocated.py b/python/test/Ice/operations/Collocated.py index bcea89c1aac..8d3eacc78f1 100755 --- a/python/test/Ice/operations/Collocated.py +++ b/python/test/Ice/operations/Collocated.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI @@ -11,12 +12,13 @@ class Collocated(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.BatchAutoFlushSize", "100") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") prx = adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) # adapter.activate() // Don't activate OA to ensure collocation is used. diff --git a/python/test/Ice/operations/Oneways.py b/python/test/Ice/operations/Oneways.py index c4ec71e3c93..d162d428897 100644 --- a/python/test/Ice/operations/Oneways.py +++ b/python/test/Ice/operations/Oneways.py @@ -3,18 +3,15 @@ # import Ice -import math import Test -import array def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def oneways(helper, p): - communicator = helper.communicator() p = Test.MyClassPrx.uncheckedCast(p.ice_oneway()) # @@ -41,6 +38,6 @@ def oneways(helper, p): # opByte # try: - p.opByte(0xff, 0x0f) + p.opByte(0xFF, 0x0F) except Ice.TwowayOnlyException: pass diff --git a/python/test/Ice/operations/OnewaysFuture.py b/python/test/Ice/operations/OnewaysFuture.py index ff4367e194c..2142c9bb6b7 100644 --- a/python/test/Ice/operations/OnewaysFuture.py +++ b/python/test/Ice/operations/OnewaysFuture.py @@ -8,11 +8,10 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def onewaysFuture(helper, proxy): - communicator = helper.communicator() p = Test.MyClassPrx.uncheckedCast(proxy.ice_oneway()) f = p.ice_pingAsync() @@ -46,7 +45,7 @@ def onewaysFuture(helper, proxy): f.sent() try: - p.opByteAsync(0xff, 0x0f) + p.opByteAsync(0xFF, 0x0F) test(False) except Ice.TwowayOnlyException: pass diff --git a/python/test/Ice/operations/Server.py b/python/test/Ice/operations/Server.py index 196783405ef..74e648a21aa 100755 --- a/python/test/Ice/operations/Server.py +++ b/python/test/Ice/operations/Server.py @@ -4,13 +4,13 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) # @@ -21,7 +21,9 @@ def run(self, args): properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/operations/ServerAMD.py b/python/test/Ice/operations/ServerAMD.py index 18eb4c2a314..64080c2f16b 100755 --- a/python/test/Ice/operations/ServerAMD.py +++ b/python/test/Ice/operations/ServerAMD.py @@ -3,7 +3,6 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import sys # # We want to test coroutines but older versions of Python cannot # load a source file that uses the async/await keywords, so we @@ -12,12 +11,12 @@ from TestAMDCoroI import MyDerivedClassI from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice class ServerAMD(TestHelper): - def run(self, args): properties = self.createTestProperties(args) # @@ -28,7 +27,9 @@ def run(self, args): properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(MyDerivedClassI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/operations/TestAMDCoroI.py b/python/test/Ice/operations/TestAMDCoroI.py index 055d43d0649..cd671e4905a 100755 --- a/python/test/Ice/operations/TestAMDCoroI.py +++ b/python/test/Ice/operations/TestAMDCoroI.py @@ -3,16 +3,15 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os import sys -import traceback import threading import time import concurrent.futures import Ice + slice_dir = Ice.getSliceDir() if not slice_dir: - print(sys.argv[0] + ': Slice directory not found.') + print(sys.argv[0] + ": Slice directory not found.") sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") @@ -21,7 +20,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class FutureThread(threading.Thread): @@ -115,8 +114,16 @@ def opMyEnum(self, p1, current=None): def opMyClass(self, p1, current=None): p2 = p1 - p3 = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity"))) - return Ice.Future.completed((Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3)) + p3 = Test.MyClassPrx.uncheckedCast( + current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")) + ) + return Ice.Future.completed( + ( + Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)), + p2, + p3, + ) + ) def opStruct(self, p1, p2, current=None): p1.s.s = "a new string" @@ -414,30 +421,67 @@ def opMyStruct1(self, value, current=None): return Ice.Future.completed(value) def opStringLiterals(self, current=None): - return Ice.Future.completed([ - Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10, - Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, - Test.sw10, - Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5, - Test.su0, Test.su1, Test.su2]) + return Ice.Future.completed( + [ + Test.s0, + Test.s1, + Test.s2, + Test.s3, + Test.s4, + Test.s5, + Test.s6, + Test.s7, + Test.s8, + Test.s9, + Test.s10, + Test.sw0, + Test.sw1, + Test.sw2, + Test.sw3, + Test.sw4, + Test.sw5, + Test.sw6, + Test.sw7, + Test.sw8, + Test.sw9, + Test.sw10, + Test.ss0, + Test.ss1, + Test.ss2, + Test.ss3, + Test.ss4, + Test.ss5, + Test.su0, + Test.su1, + Test.su2, + ] + ) def opWStringLiterals(self, current=None): return self.opStringLiterals(current) def opMStruct1(self, current): - return Ice.Future.completed(Test.MyClass.OpMStruct1MarshaledResult(Test.Structure(), current)) + return Ice.Future.completed( + Test.MyClass.OpMStruct1MarshaledResult(Test.Structure(), current) + ) def opMStruct2(self, p1, current): - return Ice.Future.completed(Test.MyClass.OpMStruct2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.MyClass.OpMStruct2MarshaledResult((p1, p1), current) + ) def opMSeq1(self, current): return Ice.Future.completed(Test.MyClass.OpMSeq1MarshaledResult([], current)) def opMSeq2(self, p1, current): - return Ice.Future.completed(Test.MyClass.OpMSeq2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.MyClass.OpMSeq2MarshaledResult((p1, p1), current) + ) def opMDict1(self, current): return Ice.Future.completed(Test.MyClass.OpMDict1MarshaledResult({}, current)) def opMDict2(self, p1, current): - return Ice.Future.completed(Test.MyClass.OpMDict2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.MyClass.OpMDict2MarshaledResult((p1, p1), current) + ) diff --git a/python/test/Ice/operations/TestAMDI.py b/python/test/Ice/operations/TestAMDI.py index bce0b0e8365..f607c171fda 100755 --- a/python/test/Ice/operations/TestAMDI.py +++ b/python/test/Ice/operations/TestAMDI.py @@ -3,25 +3,23 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os import sys -import traceback import threading import time import Ice + slice_dir = Ice.getSliceDir() if not slice_dir: - print(sys.argv[0] + ': Slice directory not found.') + print(sys.argv[0] + ": Slice directory not found.") sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") import Test -import M def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class FutureThread(threading.Thread): @@ -101,8 +99,16 @@ def opMyEnum(self, p1, current=None): def opMyClass(self, p1, current=None): p2 = p1 - p3 = Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity"))) - return Ice.Future.completed((Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3)) + p3 = Test.MyClassPrx.uncheckedCast( + current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")) + ) + return Ice.Future.completed( + ( + Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)), + p2, + p3, + ) + ) def opStruct(self, p1, p2, current=None): p1.s.s = "a new string" @@ -400,30 +406,67 @@ def opMyStruct1(self, value, current=None): return Ice.Future.completed(value) def opStringLiterals(self, current=None): - return Ice.Future.completed([ - Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10, - Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, - Test.sw10, - Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5, - Test.su0, Test.su1, Test.su2]) + return Ice.Future.completed( + [ + Test.s0, + Test.s1, + Test.s2, + Test.s3, + Test.s4, + Test.s5, + Test.s6, + Test.s7, + Test.s8, + Test.s9, + Test.s10, + Test.sw0, + Test.sw1, + Test.sw2, + Test.sw3, + Test.sw4, + Test.sw5, + Test.sw6, + Test.sw7, + Test.sw8, + Test.sw9, + Test.sw10, + Test.ss0, + Test.ss1, + Test.ss2, + Test.ss3, + Test.ss4, + Test.ss5, + Test.su0, + Test.su1, + Test.su2, + ] + ) def opWStringLiterals(self, current=None): return self.opStringLiterals(current) def opMStruct1(self, current): - return Ice.Future.completed(Test.MyClass.OpMStruct1MarshaledResult(Test.Structure(), current)) + return Ice.Future.completed( + Test.MyClass.OpMStruct1MarshaledResult(Test.Structure(), current) + ) def opMStruct2(self, p1, current): - return Ice.Future.completed(Test.MyClass.OpMStruct2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.MyClass.OpMStruct2MarshaledResult((p1, p1), current) + ) def opMSeq1(self, current): return Ice.Future.completed(Test.MyClass.OpMSeq1MarshaledResult([], current)) def opMSeq2(self, p1, current): - return Ice.Future.completed(Test.MyClass.OpMSeq2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.MyClass.OpMSeq2MarshaledResult((p1, p1), current) + ) def opMDict1(self, current): return Ice.Future.completed(Test.MyClass.OpMDict1MarshaledResult({}, current)) def opMDict2(self, p1, current): - return Ice.Future.completed(Test.MyClass.OpMDict2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.MyClass.OpMDict2MarshaledResult((p1, p1), current) + ) diff --git a/python/test/Ice/operations/TestI.py b/python/test/Ice/operations/TestI.py index d58d5ecdbcc..cfecc28668c 100644 --- a/python/test/Ice/operations/TestI.py +++ b/python/test/Ice/operations/TestI.py @@ -4,13 +4,12 @@ import Ice import Test -import sys import threading def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class MyDerivedClassI(Test.MyDerivedClass): @@ -62,8 +61,13 @@ def opMyEnum(self, p1, current=None): return (Test.MyEnum.enum3, p1) def opMyClass(self, p1, current=None): - return (Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)), p1, - Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")))) + return ( + Test.MyClassPrx.uncheckedCast(current.adapter.createProxy(current.id)), + p1, + Test.MyClassPrx.uncheckedCast( + current.adapter.createProxy(Ice.stringToIdentity("noSuchIdentity")) + ), + ) def opStruct(self, p1, p2, current=None): p1.s.s = "a new string" @@ -357,10 +361,39 @@ def opMyStruct1(self, value, current=None): return value def opStringLiterals(self, current=None): - return [Test.s0, Test.s1, Test.s2, Test.s3, Test.s4, Test.s5, Test.s6, Test.s7, Test.s8, Test.s9, Test.s10, - Test.sw0, Test.sw1, Test.sw2, Test.sw3, Test.sw4, Test.sw5, Test.sw6, Test.sw7, Test.sw8, Test.sw9, Test.sw10, - Test.ss0, Test.ss1, Test.ss2, Test.ss3, Test.ss4, Test.ss5, - Test.su0, Test.su1, Test.su2] + return [ + Test.s0, + Test.s1, + Test.s2, + Test.s3, + Test.s4, + Test.s5, + Test.s6, + Test.s7, + Test.s8, + Test.s9, + Test.s10, + Test.sw0, + Test.sw1, + Test.sw2, + Test.sw3, + Test.sw4, + Test.sw5, + Test.sw6, + Test.sw7, + Test.sw8, + Test.sw9, + Test.sw10, + Test.ss0, + Test.ss1, + Test.ss2, + Test.ss3, + Test.ss4, + Test.ss5, + Test.su0, + Test.su1, + Test.su2, + ] def opWStringLiterals(self, current=None): return self.opStringLiterals(current) diff --git a/python/test/Ice/operations/Twoways.py b/python/test/Ice/operations/Twoways.py index 877c5ca3086..c35277d6dca 100644 --- a/python/test/Ice/operations/Twoways.py +++ b/python/test/Ice/operations/Twoways.py @@ -6,17 +6,15 @@ import math import Test import array -import sys from sys import version_info def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def twoways(helper, p): - communicator = helper.communicator() literals = p.opStringLiterals() @@ -60,22 +58,34 @@ def twoways(helper, p): test(Test.s7 == literals[7]) test(Test.s7 == literals[18]) - test(Test.s8 == "\xf0\x90\x80\x80" if version_info[0] < 3 else b"\xf0\x90\x80\x80".decode("utf-8")) + test( + Test.s8 == "\xf0\x90\x80\x80" + if version_info[0] < 3 + else b"\xf0\x90\x80\x80".decode("utf-8") + ) test(Test.s8 == Test.sw8) test(Test.s8 == literals[8]) test(Test.s8 == literals[19]) - test(Test.s9 == "\xf0\x9f\x8d\x8c" if version_info[0] < 3 else b"\xf0\x9f\x8d\x8c".decode("utf-8")) + test( + Test.s9 == "\xf0\x9f\x8d\x8c" + if version_info[0] < 3 + else b"\xf0\x9f\x8d\x8c".decode("utf-8") + ) test(Test.s9 == Test.sw9) test(Test.s9 == literals[9]) test(Test.s9 == literals[20]) - test(Test.s10 == "\xe0\xb6\xa7" if version_info[0] < 3 else b"\xe0\xb6\xa7".decode("utf-8")) + test( + Test.s10 == "\xe0\xb6\xa7" + if version_info[0] < 3 + else b"\xe0\xb6\xa7".decode("utf-8") + ) test(Test.s10 == Test.sw10) test(Test.s10 == literals[10]) test(Test.s10 == literals[21]) - test(Test.ss0 == "\'\"\x3f\\\a\b\f\n\r\t\v\x06") + test(Test.ss0 == "'\"\x3f\\\a\b\f\n\r\t\v\x06") test(Test.ss0 == Test.ss1) test(Test.ss0 == Test.ss2) test(Test.ss0 == literals[22]) @@ -136,9 +146,9 @@ def twoways(helper, p): # # opByte # - r, b = p.opByte(0xff, 0x0f) - test(b == 0xf0) - test(r == 0xff) + r, b = p.opByte(0xFF, 0x0F) + test(b == 0xF0) + test(r == 0xFF) # # opBool @@ -150,19 +160,19 @@ def twoways(helper, p): # # opShortIntLong # - r, s, i, l = p.opShortIntLong(10, 11, 12) + r, s, i, l = p.opShortIntLong(10, 11, 12) # noqa: E741 test(s == 10) test(i == 11) test(l == 12) test(r == 12) - r, s, i, l = p.opShortIntLong(-32768, -2147483648, -9223372036854775808) + r, s, i, l = p.opShortIntLong(-32768, -2147483648, -9223372036854775808) # noqa: E741 test(s == -32768) test(i == -2147483648) test(l == -9223372036854775808) test(r == -9223372036854775808) - r, s, i, l = p.opShortIntLong(32767, 2147483647, 9223372036854775807) + r, s, i, l = p.opShortIntLong(32767, 2147483647, 9223372036854775807) # noqa: E741 test(s == 32767) test(i == 2147483647) test(l == 9223372036854775807) @@ -171,74 +181,74 @@ def twoways(helper, p): # # opFloatDouble # - r, f, d = p.opFloatDouble(3.14, 1.1E10) + r, f, d = p.opFloatDouble(3.14, 1.1e10) test(f - 3.14 < 0.001) - test(d == 1.1E10) - test(r == 1.1E10) + test(d == 1.1e10) + test(r == 1.1e10) # # Test invalid ranges for numbers # try: - r, b = p.opByte(0x01ff, 0x01ff) + r, b = p.opByte(0x01FF, 0x01FF) test(False) except ValueError: pass try: - r, s, i, l = p.opShortIntLong(32767 + 1, 0, 0) + r, s, i, l = p.opShortIntLong(32767 + 1, 0, 0) # noqa: E741 test(False) except ValueError: pass try: - r, s, i, l = p.opShortIntLong(-32768 - 1, 0, 0) + r, s, i, l = p.opShortIntLong(-32768 - 1, 0, 0) # noqa: E741 test(False) except ValueError: pass try: - r, s, i, l = p.opShortIntLong(0, 2147483647 + 1, 0) + r, s, i, l = p.opShortIntLong(0, 2147483647 + 1, 0) # noqa: E741 test(False) except ValueError: pass try: - r, s, i, l = p.opShortIntLong(0, -2147483648 - 1, 0) + r, s, i, l = p.opShortIntLong(0, -2147483648 - 1, 0) # noqa: E741 test(False) except ValueError: pass try: - r, s, i, l = p.opShortIntLong(0, 0, 9223372036854775807 + 1) + r, s, i, l = p.opShortIntLong(0, 0, 9223372036854775807 + 1) # noqa: E741 test(False) except ValueError: pass try: - r, s, i, l = p.opShortIntLong(0, 0, -9223372036854775808 - 1) + r, s, i, l = p.opShortIntLong(0, 0, -9223372036854775808 - 1) # noqa: E741 test(False) except ValueError: pass - r, f, d = p.opFloatDouble(3.402823466E38, 0.0) - r, f, d = p.opFloatDouble(-3.402823466E38, 0.0) + r, f, d = p.opFloatDouble(3.402823466e38, 0.0) + r, f, d = p.opFloatDouble(-3.402823466e38, 0.0) - for val in ('inf', '-inf'): + for val in ("inf", "-inf"): r, f, d = p.opFloatDouble(float(val), float(val)) test(math.isinf(r) and math.isinf(f) and math.isinf(d)) - for val in ('nan', '-nan'): + for val in ("nan", "-nan"): r, f, d = p.opFloatDouble(float(val), float(val)) test(math.isnan(r) and math.isnan(f) and math.isnan(d)) try: - r, f, d = p.opFloatDouble(3.402823466E38 * 2, 0.0) + r, f, d = p.opFloatDouble(3.402823466e38 * 2, 0.0) test(False) except ValueError: pass try: - r, f, d = p.opFloatDouble(-3.402823466E38 * 2, 0.0) + r, f, d = p.opFloatDouble(-3.402823466e38 * 2, 0.0) test(False) except ValueError: pass @@ -320,7 +330,7 @@ def twoways(helper, p): # opByteS # bsi1 = (0x01, 0x11, 0x12, 0x22) - bsi2 = (0xf1, 0xf2, 0xf3, 0xf4) + bsi2 = (0xF1, 0xF2, 0xF3, 0xF4) rso, bso = p.opByteS(bsi1, bsi2) test(len(bso) == 4) @@ -333,18 +343,18 @@ def twoways(helper, p): test(rso[1] == 0x11) test(rso[2] == 0x12) test(rso[3] == 0x22) - test(rso[4] == 0xf1) - test(rso[5] == 0xf2) - test(rso[6] == 0xf3) - test(rso[7] == 0xf4) + test(rso[4] == 0xF1) + test(rso[5] == 0xF2) + test(rso[6] == 0xF3) + test(rso[7] == 0xF4) # # opByteS (array) # - bsi1 = array.array('B') + bsi1 = array.array("B") bsi1.fromlist([0x01, 0x11, 0x12, 0x22]) - bsi2 = array.array('B') - bsi2.fromlist([0xf1, 0xf2, 0xf3, 0xf4]) + bsi2 = array.array("B") + bsi2.fromlist([0xF1, 0xF2, 0xF3, 0xF4]) rso, bso = p.opByteS(bsi1, bsi2) test(len(bso) == 4) @@ -357,10 +367,10 @@ def twoways(helper, p): test(rso[1] == 0x11) test(rso[2] == 0x12) test(rso[3] == 0x22) - test(rso[4] == 0xf1) - test(rso[5] == 0xf2) - test(rso[6] == 0xf3) - test(rso[7] == 0xf4) + test(rso[4] == 0xF1) + test(rso[5] == 0xF2) + test(rso[6] == 0xF3) + test(rso[7] == 0xF4) # # opBoolS @@ -382,9 +392,9 @@ def twoways(helper, p): # # opBoolS (array) # - bsi1 = array.array('B') + bsi1 = array.array("B") bsi1.fromlist([1, 1, 0]) - bsi2 = array.array('B') + bsi2 = array.array("B") bsi2.fromlist([0]) rso, bso = p.opBoolS(bsi1, bsi2) @@ -430,9 +440,9 @@ def twoways(helper, p): # # opShortIntLongS (array) # - ssi = array.array('h') + ssi = array.array("h") ssi.fromlist([1, 2, 3]) - isi = array.array('i') + isi = array.array("i") isi.fromlist([5, 6, 7, 8]) lsi = (10, 30, 20) # Can't store Ice::Long in an array. @@ -462,51 +472,51 @@ def twoways(helper, p): # opFloatDoubleS # fsi = (3.14, 1.11) - dsi = (1.1E10, 1.2E10, 1.3E10) + dsi = (1.1e10, 1.2e10, 1.3e10) rso, fso, dso = p.opFloatDoubleS(fsi, dsi) test(len(fso) == 2) test(fso[0] - 3.14 < 0.001) test(fso[1] - 1.11 < 0.001) test(len(dso) == 3) - test(dso[0] == 1.3E10) - test(dso[1] == 1.2E10) - test(dso[2] == 1.1E10) + test(dso[0] == 1.3e10) + test(dso[1] == 1.2e10) + test(dso[2] == 1.1e10) test(len(rso) == 5) - test(rso[0] == 1.1E10) - test(rso[1] == 1.2E10) - test(rso[2] == 1.3E10) + test(rso[0] == 1.1e10) + test(rso[1] == 1.2e10) + test(rso[2] == 1.3e10) test(rso[3] - 3.14 < 0.001) test(rso[4] - 1.11 < 0.001) # # opFloatDoubleS (array) # - fsi = array.array('f') + fsi = array.array("f") fsi.fromlist([3.14, 1.11]) - dsi = array.array('d') - dsi.fromlist([1.1E10, 1.2E10, 1.3E10]) + dsi = array.array("d") + dsi.fromlist([1.1e10, 1.2e10, 1.3e10]) rso, fso, dso = p.opFloatDoubleS(fsi, dsi) test(len(fso) == 2) test(fso[0] - 3.14 < 0.001) test(fso[1] - 1.11 < 0.001) test(len(dso) == 3) - test(dso[0] == 1.3E10) - test(dso[1] == 1.2E10) - test(dso[2] == 1.1E10) + test(dso[0] == 1.3e10) + test(dso[1] == 1.2e10) + test(dso[2] == 1.1e10) test(len(rso) == 5) - test(rso[0] == 1.1E10) - test(rso[1] == 1.2E10) - test(rso[2] == 1.3E10) + test(rso[0] == 1.1e10) + test(rso[1] == 1.2e10) + test(rso[2] == 1.3e10) test(rso[3] - 3.14 < 0.001) test(rso[4] - 1.11 < 0.001) # # opStringS # - ssi1 = ('abc', 'de', 'fghi') - ssi2 = ('xyz',) + ssi1 = ("abc", "de", "fghi") + ssi2 = ("xyz",) rso, sso = p.opStringS(ssi1, ssi2) test(len(sso) == 4) @@ -522,8 +532,8 @@ def twoways(helper, p): # # opByteSS # - bsi1 = ((0x01, 0x11, 0x12), (0xff,)) - bsi2 = ((0x0e,), (0xf2, 0xf1)) + bsi1 = ((0x01, 0x11, 0x12), (0xFF,)) + bsi2 = ((0x0E,), (0xF2, 0xF1)) rso, bso = p.opByteSS(bsi1, bsi2) test(len(bso) == 2) @@ -534,22 +544,26 @@ def twoways(helper, p): test(len(rso[1]) == 1) test(len(rso[2]) == 1) test(len(rso[3]) == 2) - test(bso[0][0] == 0xff) + test(bso[0][0] == 0xFF) test(bso[1][0] == 0x01) test(bso[1][1] == 0x11) test(bso[1][2] == 0x12) test(rso[0][0] == 0x01) test(rso[0][1] == 0x11) test(rso[0][2] == 0x12) - test(rso[1][0] == 0xff) - test(rso[2][0] == 0x0e) - test(rso[3][0] == 0xf2) - test(rso[3][1] == 0xf1) + test(rso[1][0] == 0xFF) + test(rso[2][0] == 0x0E) + test(rso[3][0] == 0xF2) + test(rso[3][1] == 0xF1) # # opBoolSS # - bsi1 = ((True,), (False,), (True, True),) + bsi1 = ( + (True,), + (False,), + (True, True), + ) bsi2 = ((False, False, True),) rso, bso = p.opBoolSS(bsi1, bsi2) @@ -612,7 +626,7 @@ def twoways(helper, p): # opFloatDoubleSS # fsi = ((3.14,), (1.11,), ()) - dsi = ((1.1E10, 1.2E10, 1.3E10),) + dsi = ((1.1e10, 1.2e10, 1.3e10),) rso, fso, dso = p.opFloatDoubleSS(fsi, dsi) test(len(fso) == 3) @@ -623,24 +637,24 @@ def twoways(helper, p): test(len(fso[2]) == 0) test(len(dso) == 1) test(len(dso[0]) == 3) - test(dso[0][0] == 1.1E10) - test(dso[0][1] == 1.2E10) - test(dso[0][2] == 1.3E10) + test(dso[0][0] == 1.1e10) + test(dso[0][1] == 1.2e10) + test(dso[0][2] == 1.3e10) test(len(rso) == 2) test(len(rso[0]) == 3) - test(rso[0][0] == 1.1E10) - test(rso[0][1] == 1.2E10) - test(rso[0][2] == 1.3E10) + test(rso[0][0] == 1.1e10) + test(rso[0][1] == 1.2e10) + test(rso[0][2] == 1.3e10) test(len(rso[1]) == 3) - test(rso[1][0] == 1.1E10) - test(rso[1][1] == 1.2E10) - test(rso[1][2] == 1.3E10) + test(rso[1][0] == 1.1e10) + test(rso[1][1] == 1.2e10) + test(rso[1][2] == 1.3e10) # # opStringSS # - ssi1 = (('abc',), ('de', 'fghi')) - ssi2 = ((), (), ('xyz',)) + ssi1 = (("abc",), ("de", "fghi")) + ssi2 = ((), (), ("xyz",)) rso, sso = p.opStringSS(ssi1, ssi2) test(len(sso) == 5) @@ -662,8 +676,8 @@ def twoways(helper, p): # # opStringSSS # - sssi1 = ((('abc', 'de'), ('xyz',)), (('hello',),)) - sssi2 = ((('', ''), ('abcd',)), (('',),), ()) + sssi1 = ((("abc", "de"), ("xyz",)), (("hello",),)) + sssi2 = ((("", ""), ("abcd",)), (("",),), ()) rsso, ssso = p.opStringSSS(sssi1, sssi2) test(len(ssso) == 5) @@ -748,8 +762,8 @@ def twoways(helper, p): # # opStringStringD # - di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'} - di2 = {'foo': 'abc -1.1', 'FOO': 'abc -100.4', 'BAR': 'abc 0.5'} + di1 = {"foo": "abc -1.1", "bar": "abc 123123.2"} + di2 = {"foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"} ro, do = p.opStringStringD(di1, di2) @@ -763,8 +777,12 @@ def twoways(helper, p): # # opStringMyEnumD # - di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2} - di2 = {'abc': Test.MyEnum.enum1, 'qwerty': Test.MyEnum.enum3, 'Hello!!': Test.MyEnum.enum2} + di1 = {"abc": Test.MyEnum.enum1, "": Test.MyEnum.enum2} + di2 = { + "abc": Test.MyEnum.enum1, + "qwerty": Test.MyEnum.enum3, + "Hello!!": Test.MyEnum.enum2, + } ro, do = p.opStringMyEnumD(di1, di2) @@ -778,8 +796,8 @@ def twoways(helper, p): # # opMyEnumStringD # - di1 = {Test.MyEnum.enum1: 'abc'} - di2 = {Test.MyEnum.enum2: 'Hello!!', Test.MyEnum.enum3: 'qwerty'} + di1 = {Test.MyEnum.enum1: "abc"} + di2 = {Test.MyEnum.enum2: "Hello!!", Test.MyEnum.enum3: "qwerty"} ro, do = p.opMyEnumStringD(di1, di2) @@ -875,7 +893,10 @@ def twoways(helper, p): # # opLongFloatDS # - dsi1 = ({999999110: -1.1, 999999111: 123123.2}, {999999110: -1.1, 999999120: -100.4, 999999130: 0.5}) + dsi1 = ( + {999999110: -1.1, 999999111: 123123.2}, + {999999110: -1.1, 999999120: -100.4, 999999130: 0.5}, + ) dsi2 = ({999999140: 3.14},) ro, do = p.opLongFloatDS(dsi1, dsi2) @@ -904,7 +925,10 @@ def twoways(helper, p): # opStringStringDS # - dsi1 = ({"foo": "abc -1.1", "bar": "abc 123123.2"}, {"foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"}) + dsi1 = ( + {"foo": "abc -1.1", "bar": "abc 123123.2"}, + {"foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"}, + ) dsi2 = ({"f00": "ABC -3.14"},) ro, do = p.opStringStringDS(dsi1, dsi2) @@ -934,7 +958,11 @@ def twoways(helper, p): # dsi1 = ( {"abc": Test.MyEnum.enum1, "": Test.MyEnum.enum2}, - {"abc": Test.MyEnum.enum1, "qwerty": Test.MyEnum.enum3, "Hello!!": Test.MyEnum.enum2} + { + "abc": Test.MyEnum.enum1, + "qwerty": Test.MyEnum.enum3, + "Hello!!": Test.MyEnum.enum2, + }, ) dsi2 = ({"Goodbye": Test.MyEnum.enum1},) @@ -964,8 +992,11 @@ def twoways(helper, p): # # opMyEnumStringDS # - dsi1 = ({Test.MyEnum.enum1: 'abc'}, {Test.MyEnum.enum2: 'Hello!!', Test.MyEnum.enum3: 'qwerty'}) - dsi2 = ({Test.MyEnum.enum1: 'Goodbye'},) + dsi1 = ( + {Test.MyEnum.enum1: "abc"}, + {Test.MyEnum.enum2: "Hello!!", Test.MyEnum.enum3: "qwerty"}, + ) + dsi2 = ({Test.MyEnum.enum1: "Goodbye"},) ro, do = p.opMyEnumStringDS(dsi1, dsi2) @@ -996,7 +1027,7 @@ def twoways(helper, p): dsi1 = ( {s11: Test.MyEnum.enum1, s12: Test.MyEnum.enum2}, - {s11: Test.MyEnum.enum1, s22: Test.MyEnum.enum3, s23: Test.MyEnum.enum2} + {s11: Test.MyEnum.enum1, s22: Test.MyEnum.enum3, s23: Test.MyEnum.enum2}, ) dsi2 = ({s23: Test.MyEnum.enum3},) @@ -1026,23 +1057,23 @@ def twoways(helper, p): # opByteByteSD # sdi1 = {0x01: (0x01, 0x11), 0x22: (0x12,)} - sdi2 = {0xf1: (0xf2, 0xf3)} + sdi2 = {0xF1: (0xF2, 0xF3)} ro, do = p.opByteByteSD(sdi1, sdi2) test(len(do) == 1) - test(len(do[0xf1]) == 2) - test(do[0xf1][0] == 0xf2) - test(do[0xf1][1] == 0xf3) + test(len(do[0xF1]) == 2) + test(do[0xF1][0] == 0xF2) + test(do[0xF1][1] == 0xF3) test(len(ro) == 3) test(len(ro[0x01]) == 2) test(ro[0x01][0] == 0x01) test(ro[0x01][1] == 0x11) test(len(ro[0x22]) == 1) test(ro[0x22][0] == 0x12) - test(len(ro[0xf1]) == 2) - test(ro[0xf1][0] == 0xf2) - test(ro[0xf1][1] == 0xf3) + test(len(ro[0xF1]) == 2) + test(ro[0xF1][0] == 0xF2) + test(ro[0xF1][1] == 0xF3) # # opBoolBoolSD @@ -1116,7 +1147,10 @@ def twoways(helper, p): # # opLongLongSD # - sdi1 = {999999990: (999999110, 999999111, 999999110), 999999991: (999999120, 999999130)} + sdi1 = { + 999999990: (999999110, 999999111, 999999110), + 999999991: (999999120, 999999130), + } sdi2 = {999999992: (999999110, 999999120)} ro, do = p.opLongLongSD(sdi1, sdi2) @@ -1165,26 +1199,26 @@ def twoways(helper, p): # # opStringDoubleSD # - sdi1 = {"Hello!!": (1.1E10, 1.2E10, 1.3E10), "Goodbye": (1.4E10, 1.5E10)} - sdi2 = {"": (1.6E10, 1.7E10)} + sdi1 = {"Hello!!": (1.1e10, 1.2e10, 1.3e10), "Goodbye": (1.4e10, 1.5e10)} + sdi2 = {"": (1.6e10, 1.7e10)} ro, do = p.opStringDoubleSD(sdi1, sdi2) test(len(do) == 1) test(len(do[""]) == 2) - test(do[""][0] == 1.6E10) - test(do[""][1] == 1.7E10) + test(do[""][0] == 1.6e10) + test(do[""][1] == 1.7e10) test(len(ro) == 3) test(len(ro["Hello!!"]) == 3) - test(ro["Hello!!"][0] == 1.1E10) - test(ro["Hello!!"][1] == 1.2E10) - test(ro["Hello!!"][2] == 1.3E10) + test(ro["Hello!!"][0] == 1.1e10) + test(ro["Hello!!"][1] == 1.2e10) + test(ro["Hello!!"][2] == 1.3e10) test(len(ro["Goodbye"]) == 2) - test(ro["Goodbye"][0] == 1.4E10) - test(ro["Goodbye"][1] == 1.5E10) + test(ro["Goodbye"][0] == 1.4e10) + test(ro["Goodbye"][1] == 1.5e10) test(len(ro[""]) == 2) - test(ro[""][0] == 1.6E10) - test(ro[""][1] == 1.7E10) + test(ro[""][0] == 1.6e10) + test(ro[""][1] == 1.7e10) # # opStringStringSD @@ -1215,7 +1249,7 @@ def twoways(helper, p): # sdi1 = { Test.MyEnum.enum3: (Test.MyEnum.enum1, Test.MyEnum.enum1, Test.MyEnum.enum2), - Test.MyEnum.enum2: (Test.MyEnum.enum1, Test.MyEnum.enum2) + Test.MyEnum.enum2: (Test.MyEnum.enum1, Test.MyEnum.enum2), } sdi2 = {Test.MyEnum.enum1: (Test.MyEnum.enum3, Test.MyEnum.enum3)} @@ -1241,19 +1275,19 @@ def twoways(helper, p): # opIntS # lengths = (0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000) - for l in lengths: + for length in lengths: s = [] - for i in range(l): + for i in range(length): s.append(i) r = p.opIntS(s) - test(len(r) == l) + test(len(r) == length) for j in range(len(r)): test(r[j] == -j) # # opContext # - ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'} + ctx = {"one": "ONE", "two": "TWO", "three": "THREE"} r = p.opContext() test(len(p.ice_getContext()) == 0) @@ -1274,35 +1308,37 @@ def twoways(helper, p): # Test implicit context propagation # if p.ice_getConnection(): - impls = ('Shared', 'PerThread') + impls = ("Shared", "PerThread") for i in impls: initData = Ice.InitializationData() initData.properties = communicator.getProperties().clone() - initData.properties.setProperty('Ice.ImplicitContext', i) + initData.properties.setProperty("Ice.ImplicitContext", i) ic = Ice.initialize(data=initData) - ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'} + ctx = {"one": "ONE", "two": "TWO", "three": "THREE"} - p1 = Test.MyClassPrx.uncheckedCast(ic.stringToProxy('test:{0}'.format(helper.getTestEndpoint()))) + p1 = Test.MyClassPrx.uncheckedCast( + ic.stringToProxy("test:{0}".format(helper.getTestEndpoint())) + ) ic.getImplicitContext().setContext(ctx) test(ic.getImplicitContext().getContext() == ctx) test(p1.opContext() == ctx) - test(ic.getImplicitContext().containsKey('zero') == False) - r = ic.getImplicitContext().put('zero', 'ZERO') - test(r == '') - test(ic.getImplicitContext().containsKey('zero') == True) - test(ic.getImplicitContext().get('zero') == 'ZERO') + test(ic.getImplicitContext().containsKey("zero") is False) + r = ic.getImplicitContext().put("zero", "ZERO") + test(r == "") + test(ic.getImplicitContext().containsKey("zero") is True) + test(ic.getImplicitContext().get("zero") == "ZERO") ctx = ic.getImplicitContext().getContext() test(p1.opContext() == ctx) - prxContext = {'one': 'UN', 'four': 'QUATRE'} + prxContext = {"one": "UN", "four": "QUATRE"} combined = ctx.copy() combined.update(prxContext) - test(combined['one'] == 'UN') + test(combined["one"] == "UN") p2 = Test.MyClassPrx.uncheckedCast(p1.ice_context(prxContext)) @@ -1312,7 +1348,7 @@ def twoways(helper, p): ic.getImplicitContext().setContext(ctx) test(p2.opContext() == combined) - test(ic.getImplicitContext().remove('one') == 'ONE') + test(ic.getImplicitContext().remove("one") == "ONE") ic.destroy() @@ -1351,7 +1387,7 @@ def twoways(helper, p): s.myStruct1 = "Test.MyStruct1.myStruct1" s = d.opMyStruct1(s) test(s.tesT == "Test.MyStruct1.s") - test(s.myClass == None) + test(s.myClass is None) test(s.myStruct1 == "Test.MyStruct1.myStruct1") c = Test.MyClass1() c.tesT = "Test.MyClass1.testT" @@ -1359,7 +1395,7 @@ def twoways(helper, p): c.myClass1 = "Test.MyClass1.myClass1" c = d.opMyClass1(c) test(c.tesT == "Test.MyClass1.testT") - test(c.myClass == None) + test(c.myClass is None) test(c.myClass1 == "Test.MyClass1.myClass1") p1 = p.opMStruct1() diff --git a/python/test/Ice/operations/TwowaysFuture.py b/python/test/Ice/operations/TwowaysFuture.py index 5515404faee..d16fa4e74d2 100644 --- a/python/test/Ice/operations/TwowaysFuture.py +++ b/python/test/Ice/operations/TwowaysFuture.py @@ -5,13 +5,12 @@ import Ice import Test import math -import sys import threading def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CallbackBase: @@ -39,10 +38,10 @@ def __init__(self, communicator=None): def opByte(self, f): try: (r, b) = f.result() - test(b == 0xf0) - test(r == 0xff) + test(b == 0xF0) + test(r == 0xFF) self.called() - except: + except Exception: test(False) def opBool(self, f): @@ -51,28 +50,28 @@ def opBool(self, f): test(b) test(not r) self.called() - except: + except Exception: test(False) def opShortIntLong(self, f): try: - (r, s, i, l) = f.result() + (r, s, i, l) = f.result() # noqa: E741 test(s == 10) test(i == 11) test(l == 12) test(r == 12) self.called() - except: + except Exception: test(False) def opFloatDouble(self, fut): try: (r, f, d) = fut.result() test(f - 3.14 < 0.001) - test(d == 1.1E10) - test(r == 1.1E10) + test(d == 1.1e10) + test(r == 1.1e10) self.called() - except: + except Exception: test(False) def opString(self, f): @@ -81,7 +80,7 @@ def opString(self, f): test(s == "world hello") test(r == "hello world") self.called() - except: + except Exception: test(False) def opMyEnum(self, f): @@ -90,7 +89,7 @@ def opMyEnum(self, f): test(e == Test.MyEnum.enum2) test(r == Test.MyEnum.enum3) self.called() - except: + except Exception: test(False) def opMyClass(self, f): @@ -100,7 +99,12 @@ def opMyClass(self, f): test(c2.ice_getIdentity() == Ice.stringToIdentity("noSuchIdentity")) test(r.ice_getIdentity() == Ice.stringToIdentity("test")) # We can't do the callbacks below in serialize mode - if self._communicator.getProperties().getPropertyAsInt("Ice.Client.ThreadPool.Serialize") == 0: + if ( + self._communicator.getProperties().getPropertyAsInt( + "Ice.Client.ThreadPool.Serialize" + ) + == 0 + ): r.opVoid() c1.opVoid() try: @@ -109,22 +113,27 @@ def opMyClass(self, f): except Ice.ObjectNotExistException: pass self.called() - except: + except Exception: test(False) def opStruct(self, f): try: (rso, so) = f.result() - test(rso.p == None) + test(rso.p is None) test(rso.e == Test.MyEnum.enum2) test(rso.s.s == "def") test(so.e == Test.MyEnum.enum3) test(so.s.s == "a new string") # We can't do the callbacks below in serialize mode. - if self._communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0: + if ( + self._communicator.getProperties().getPropertyAsInt( + "Ice.ThreadPool.Client.Serialize" + ) + == 0 + ): so.p.opVoid() self.called() - except: + except Exception: test(False) def opByteS(self, f): @@ -140,12 +149,12 @@ def opByteS(self, f): test(rso[1] == 0x11) test(rso[2] == 0x12) test(rso[3] == 0x22) - test(rso[4] == 0xf1) - test(rso[5] == 0xf2) - test(rso[6] == 0xf3) - test(rso[7] == 0xf4) + test(rso[4] == 0xF1) + test(rso[5] == 0xF2) + test(rso[6] == 0xF3) + test(rso[7] == 0xF4) self.called() - except: + except Exception: test(False) def opBoolS(self, f): @@ -161,7 +170,7 @@ def opBoolS(self, f): test(rso[1]) test(rso[2]) self.called() - except: + except Exception: test(False) def opShortIntLongS(self, f): @@ -188,7 +197,7 @@ def opShortIntLongS(self, f): test(rso[1] == 30) test(rso[2] == 20) self.called() - except: + except Exception: test(False) def opFloatDoubleS(self, f): @@ -198,17 +207,17 @@ def opFloatDoubleS(self, f): test(fso[0] - 3.14 < 0.001) test(fso[1] - 1.11 < 0.001) test(len(dso) == 3) - test(dso[0] == 1.3E10) - test(dso[1] == 1.2E10) - test(dso[2] == 1.1E10) + test(dso[0] == 1.3e10) + test(dso[1] == 1.2e10) + test(dso[2] == 1.1e10) test(len(rso) == 5) - test(rso[0] == 1.1E10) - test(rso[1] == 1.2E10) - test(rso[2] == 1.3E10) + test(rso[0] == 1.1e10) + test(rso[1] == 1.2e10) + test(rso[2] == 1.3e10) test(rso[3] - 3.14 < 0.001) test(rso[4] - 1.11 < 0.001) self.called() - except: + except Exception: test(False) def opStringS(self, f): @@ -224,7 +233,7 @@ def opStringS(self, f): test(rso[1] == "de") test(rso[2] == "abc") self.called() - except: + except Exception: test(False) def opByteSS(self, f): @@ -238,19 +247,19 @@ def opByteSS(self, f): test(len(rso[1]) == 1) test(len(rso[2]) == 1) test(len(rso[3]) == 2) - test(bso[0][0] == 0xff) + test(bso[0][0] == 0xFF) test(bso[1][0] == 0x01) test(bso[1][1] == 0x11) test(bso[1][2] == 0x12) test(rso[0][0] == 0x01) test(rso[0][1] == 0x11) test(rso[0][2] == 0x12) - test(rso[1][0] == 0xff) - test(rso[2][0] == 0x0e) - test(rso[3][0] == 0xf2) - test(rso[3][1] == 0xf1) + test(rso[1][0] == 0xFF) + test(rso[2][0] == 0x0E) + test(rso[3][0] == 0xF2) + test(rso[3][1] == 0xF1) self.called() - except: + except Exception: test(False) def opBoolSS(self, f): @@ -277,7 +286,7 @@ def opBoolSS(self, f): test(len(rso[2]) == 1) test(rso[2][0]) self.called() - except: + except Exception: test(False) def opShortIntLongSS(self, f): @@ -309,7 +318,7 @@ def opShortIntLongSS(self, f): test(lso[1][0] == 496) test(lso[1][1] == 1729) self.called() - except: + except Exception: test(False) def opFloatDoubleSS(self, f): @@ -323,20 +332,20 @@ def opFloatDoubleSS(self, f): test(len(fso[2]) == 0) test(len(dso) == 1) test(len(dso[0]) == 3) - test(dso[0][0] == 1.1E10) - test(dso[0][1] == 1.2E10) - test(dso[0][2] == 1.3E10) + test(dso[0][0] == 1.1e10) + test(dso[0][1] == 1.2e10) + test(dso[0][2] == 1.3e10) test(len(rso) == 2) test(len(rso[0]) == 3) - test(rso[0][0] == 1.1E10) - test(rso[0][1] == 1.2E10) - test(rso[0][2] == 1.3E10) + test(rso[0][0] == 1.1e10) + test(rso[0][1] == 1.2e10) + test(rso[0][2] == 1.3e10) test(len(rso[1]) == 3) - test(rso[1][0] == 1.1E10) - test(rso[1][1] == 1.2E10) - test(rso[1][2] == 1.3E10) + test(rso[1][0] == 1.1e10) + test(rso[1][1] == 1.2e10) + test(rso[1][2] == 1.3e10) self.called() - except: + except Exception: test(False) def opStringSS(self, f): @@ -358,7 +367,7 @@ def opStringSS(self, f): test(len(rso[1]) == 0) test(len(rso[2]) == 0) self.called() - except: + except Exception: test(False) def opByteBoolD(self, f): @@ -372,7 +381,7 @@ def opByteBoolD(self, f): test(not ro[100]) test(ro[101]) self.called() - except: + except Exception: test(False) def opShortIntD(self, f): @@ -386,7 +395,7 @@ def opShortIntD(self, f): test(ro[1100] == 123123) test(ro[1101] == 0) self.called() - except: + except Exception: test(False) def opLongFloatD(self, f): @@ -401,13 +410,13 @@ def opLongFloatD(self, f): test(ro[999999111] - 123123.2 < 0.01) test(ro[999999130] - 0.5 < 0.01) self.called() - except: + except Exception: test(False) def opStringStringD(self, f): try: (ro, do) = f.result() - di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'} + di1 = {"foo": "abc -1.1", "bar": "abc 123123.2"} test(do == di1) test(len(ro) == 4) test(ro["foo"] == "abc -1.1") @@ -415,13 +424,13 @@ def opStringStringD(self, f): test(ro["bar"] == "abc 123123.2") test(ro["BAR"] == "abc 0.5") self.called() - except: + except Exception: test(False) def opStringMyEnumD(self, f): try: (ro, do) = f.result() - di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2} + di1 = {"abc": Test.MyEnum.enum1, "": Test.MyEnum.enum2} test(do == di1) test(len(ro) == 4) test(ro["abc"] == Test.MyEnum.enum1) @@ -429,20 +438,20 @@ def opStringMyEnumD(self, f): test(ro[""] == Test.MyEnum.enum2) test(ro["Hello!!"] == Test.MyEnum.enum2) self.called() - except: + except Exception: test(False) def opMyEnumStringD(self, f): try: (ro, do) = f.result() - di1 = {Test.MyEnum.enum1: 'abc'} + di1 = {Test.MyEnum.enum1: "abc"} test(do == di1) test(len(ro) == 3) test(ro[Test.MyEnum.enum1] == "abc") test(ro[Test.MyEnum.enum2] == "Hello!!") test(ro[Test.MyEnum.enum3] == "qwerty") self.called() - except: + except Exception: test(False) def opMyStructMyEnumD(self, f): @@ -468,7 +477,7 @@ def opMyStructMyEnumD(self, f): test(ro[s22] == Test.MyEnum.enum3) test(ro[s23] == Test.MyEnum.enum2) self.called() - except: + except Exception: test(False) def opByteBoolDS(self, f): @@ -494,7 +503,7 @@ def opByteBoolDS(self, f): test(not do[2][11]) test(do[2][101]) self.called() - except: + except Exception: test(False) def opShortIntDS(self, f): @@ -519,7 +528,7 @@ def opShortIntDS(self, f): test(do[2][111] == -100) test(do[2][1101] == 0) self.called() - except: + except Exception: test(False) def opLongFloatDS(self, f): @@ -544,7 +553,7 @@ def opLongFloatDS(self, f): test(do[2][999999120] - -100.4 < 0.01) test(do[2][999999130] - 0.5 < 0.01) self.called() - except: + except Exception: test(False) def opStringStringDS(self, f): @@ -569,7 +578,7 @@ def opStringStringDS(self, f): test(do[2]["FOO"] == "abc -100.4") test(do[2]["BAR"] == "abc 0.5") self.called() - except: + except Exception: test(False) def opStringMyEnumDS(self, f): @@ -594,7 +603,7 @@ def opStringMyEnumDS(self, f): test(do[2]["qwerty"] == Test.MyEnum.enum3) test(do[2]["Hello!!"] == Test.MyEnum.enum2) self.called() - except: + except Exception: test(False) def opMyEnumStringDS(self, f): @@ -615,7 +624,7 @@ def opMyEnumStringDS(self, f): test(do[2][Test.MyEnum.enum2] == "Hello!!") test(do[2][Test.MyEnum.enum3] == "qwerty") self.called() - except: + except Exception: test(False) def opMyStructMyEnumDS(self, f): @@ -644,27 +653,27 @@ def opMyStructMyEnumDS(self, f): test(do[2][s22] == Test.MyEnum.enum3) test(do[2][s23] == Test.MyEnum.enum2) self.called() - except: + except Exception: test(False) def opByteByteSD(self, f): try: (ro, do) = f.result() test(len(do) == 1) - test(len(do[0xf1]) == 2) - test(do[0xf1][0] == 0xf2) - test(do[0xf1][1] == 0xf3) + test(len(do[0xF1]) == 2) + test(do[0xF1][0] == 0xF2) + test(do[0xF1][1] == 0xF3) test(len(ro) == 3) test(len(ro[0x01]) == 2) test(ro[0x01][0] == 0x01) test(ro[0x01][1] == 0x11) test(len(ro[0x22]) == 1) test(ro[0x22][0] == 0x12) - test(len(ro[0xf1]) == 2) - test(ro[0xf1][0] == 0xf2) - test(ro[0xf1][1] == 0xf3) + test(len(ro[0xF1]) == 2) + test(ro[0xF1][0] == 0xF2) + test(ro[0xF1][1] == 0xF3) self.called() - except: + except Exception: test(False) def opBoolBoolSD(self, f): @@ -683,7 +692,7 @@ def opBoolBoolSD(self, f): test(ro[True][1]) test(ro[True][2]) self.called() - except: + except Exception: test(False) def opShortShortSD(self, f): @@ -705,7 +714,7 @@ def opShortShortSD(self, f): test(ro[4][0] == 6) test(ro[4][1] == 7) self.called() - except: + except Exception: test(False) def opIntIntSD(self, f): @@ -727,7 +736,7 @@ def opIntIntSD(self, f): test(ro[400][0] == 600) test(ro[400][1] == 700) self.called() - except: + except Exception: test(False) def opLongLongSD(self, f): @@ -749,7 +758,7 @@ def opLongLongSD(self, f): test(ro[999999992][0] == 999999110) test(ro[999999992][1] == 999999120) self.called() - except: + except Exception: test(False) def opStringFloatSD(self, f): @@ -771,7 +780,7 @@ def opStringFloatSD(self, f): test(ro["aBc"][0] - -3.14 < 0.10) test(ro["aBc"][1] - 3.14 < 0.10) self.called() - except: + except Exception: test(False) def opStringDoubleSD(self, f): @@ -779,21 +788,21 @@ def opStringDoubleSD(self, f): (ro, do) = f.result() test(len(do) == 1) test(len(do[""]) == 2) - test(do[""][0] == 1.6E10) - test(do[""][1] == 1.7E10) + test(do[""][0] == 1.6e10) + test(do[""][1] == 1.7e10) test(len(ro) == 3) test(len(ro["Hello!!"]) == 3) - test(ro["Hello!!"][0] == 1.1E10) - test(ro["Hello!!"][1] == 1.2E10) - test(ro["Hello!!"][2] == 1.3E10) + test(ro["Hello!!"][0] == 1.1e10) + test(ro["Hello!!"][1] == 1.2e10) + test(ro["Hello!!"][2] == 1.3e10) test(len(ro["Goodbye"]) == 2) - test(ro["Goodbye"][0] == 1.4E10) - test(ro["Goodbye"][1] == 1.5E10) + test(ro["Goodbye"][0] == 1.4e10) + test(ro["Goodbye"][1] == 1.5e10) test(len(ro[""]) == 2) - test(ro[""][0] == 1.6E10) - test(ro[""][1] == 1.7E10) + test(ro[""][0] == 1.6e10) + test(ro[""][1] == 1.7e10) self.called() - except: + except Exception: test(False) def opStringStringSD(self, f): @@ -815,7 +824,7 @@ def opStringStringSD(self, f): test(ro["ghi"][0] == "and") test(ro["ghi"][1] == "xor") self.called() - except: + except Exception: test(False) def opMyEnumMyEnumSD(self, f): @@ -837,7 +846,7 @@ def opMyEnumMyEnumSD(self, f): test(ro[Test.MyEnum.enum1][0] == Test.MyEnum.enum3) test(ro[Test.MyEnum.enum1][1] == Test.MyEnum.enum3) self.called() - except: + except Exception: test(False) def opIntS(self, f): @@ -846,7 +855,7 @@ def opIntS(self, f): for j in range(0, len(r)): test(r[j] == -j) self.called() - except: + except Exception: test(False) def opIdempotent(self, f): @@ -880,13 +889,13 @@ def twowaysFuture(helper, p): p.opVoidAsync().add_done_callback(lambda f: cb.called()) cb.check() - f = p.opByteAsync(0xff, 0x0f) + f = p.opByteAsync(0xFF, 0x0F) (ret, p3) = f.result() - test(p3 == 0xf0) - test(ret == 0xff) + test(p3 == 0xF0) + test(ret == 0xFF) cb = Callback() - p.opByteAsync(0xff, 0x0f).add_done_callback(cb.opByte) + p.opByteAsync(0xFF, 0x0F).add_done_callback(cb.opByte) cb.check() cb = Callback() @@ -898,7 +907,7 @@ def twowaysFuture(helper, p): cb.check() cb = Callback() - p.opFloatDoubleAsync(3.14, 1.1E10).add_done_callback(cb.opFloatDouble) + p.opFloatDoubleAsync(3.14, 1.1e10).add_done_callback(cb.opFloatDouble) cb.check() cb = Callback() @@ -929,7 +938,7 @@ def twowaysFuture(helper, p): cb.check() bsi1 = (0x01, 0x11, 0x12, 0x22) - bsi2 = (0xf1, 0xf2, 0xf3, 0xf4) + bsi2 = (0xF1, 0xF2, 0xF3, 0xF4) cb = Callback() p.opByteSAsync(bsi1, bsi2).add_done_callback(cb.opByteS) @@ -951,27 +960,31 @@ def twowaysFuture(helper, p): cb.check() fsi = (3.14, 1.11) - dsi = (1.1E10, 1.2E10, 1.3E10) + dsi = (1.1e10, 1.2e10, 1.3e10) cb = Callback() p.opFloatDoubleSAsync(fsi, dsi).add_done_callback(cb.opFloatDoubleS) cb.check() - ssi1 = ('abc', 'de', 'fghi') - ssi2 = ('xyz',) + ssi1 = ("abc", "de", "fghi") + ssi2 = ("xyz",) cb = Callback() p.opStringSAsync(ssi1, ssi2).add_done_callback(cb.opStringS) cb.check() - bsi1 = ((0x01, 0x11, 0x12), (0xff,)) - bsi2 = ((0x0e,), (0xf2, 0xf1)) + bsi1 = ((0x01, 0x11, 0x12), (0xFF,)) + bsi2 = ((0x0E,), (0xF2, 0xF1)) cb = Callback() p.opByteSSAsync(bsi1, bsi2).add_done_callback(cb.opByteSS) cb.check() - bsi1 = ((True,), (False,), (True, True),) + bsi1 = ( + (True,), + (False,), + (True, True), + ) bsi2 = ((False, False, True),) cb = Callback() @@ -987,14 +1000,14 @@ def twowaysFuture(helper, p): cb.check() fsi = ((3.14,), (1.11,), ()) - dsi = ((1.1E10, 1.2E10, 1.3E10),) + dsi = ((1.1e10, 1.2e10, 1.3e10),) cb = Callback() p.opFloatDoubleSSAsync(fsi, dsi).add_done_callback(cb.opFloatDoubleSS) cb.check() - ssi1 = (('abc',), ('de', 'fghi')) - ssi2 = ((), (), ('xyz',)) + ssi1 = (("abc",), ("de", "fghi")) + ssi2 = ((), (), ("xyz",)) cb = Callback() p.opStringSSAsync(ssi1, ssi2).add_done_callback(cb.opStringSS) @@ -1021,22 +1034,26 @@ def twowaysFuture(helper, p): p.opLongFloatDAsync(di1, di2).add_done_callback(cb.opLongFloatD) cb.check() - di1 = {'foo': 'abc -1.1', 'bar': 'abc 123123.2'} - di2 = {'foo': 'abc -1.1', 'FOO': 'abc -100.4', 'BAR': 'abc 0.5'} + di1 = {"foo": "abc -1.1", "bar": "abc 123123.2"} + di2 = {"foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"} cb = Callback() p.opStringStringDAsync(di1, di2).add_done_callback(cb.opStringStringD) cb.check() - di1 = {'abc': Test.MyEnum.enum1, '': Test.MyEnum.enum2} - di2 = {'abc': Test.MyEnum.enum1, 'qwerty': Test.MyEnum.enum3, 'Hello!!': Test.MyEnum.enum2} + di1 = {"abc": Test.MyEnum.enum1, "": Test.MyEnum.enum2} + di2 = { + "abc": Test.MyEnum.enum1, + "qwerty": Test.MyEnum.enum3, + "Hello!!": Test.MyEnum.enum2, + } cb = Callback() p.opStringMyEnumDAsync(di1, di2).add_done_callback(cb.opStringMyEnumD) cb.check() - di1 = {Test.MyEnum.enum1: 'abc'} - di2 = {Test.MyEnum.enum2: 'Hello!!', Test.MyEnum.enum3: 'qwerty'} + di1 = {Test.MyEnum.enum1: "abc"} + di2 = {Test.MyEnum.enum2: "Hello!!", Test.MyEnum.enum3: "qwerty"} cb = Callback() p.opMyEnumStringDAsync(di1, di2).add_done_callback(cb.opMyEnumStringD) @@ -1075,14 +1092,20 @@ def twowaysFuture(helper, p): p.opShortIntDSAsync(dsi1, dsi2).add_done_callback(cb.opShortIntDS) cb.called() - dsi1 = ({999999110: -1.1, 999999111: 123123.2}, {999999110: -1.1, 999999120: -100.4, 999999130: 0.5}) + dsi1 = ( + {999999110: -1.1, 999999111: 123123.2}, + {999999110: -1.1, 999999120: -100.4, 999999130: 0.5}, + ) dsi2 = ({999999140: 3.14},) cb = Callback() p.opLongFloatDSAsync(dsi1, dsi2).add_done_callback(cb.opLongFloatDS) cb.called() - dsi1 = ({"foo": "abc -1.1", "bar": "abc 123123.2"}, {"foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"}) + dsi1 = ( + {"foo": "abc -1.1", "bar": "abc 123123.2"}, + {"foo": "abc -1.1", "FOO": "abc -100.4", "BAR": "abc 0.5"}, + ) dsi2 = ({"f00": "ABC -3.14"},) cb = Callback() @@ -1091,7 +1114,11 @@ def twowaysFuture(helper, p): dsi1 = ( {"abc": Test.MyEnum.enum1, "": Test.MyEnum.enum2}, - {"abc": Test.MyEnum.enum1, "qwerty": Test.MyEnum.enum3, "Hello!!": Test.MyEnum.enum2} + { + "abc": Test.MyEnum.enum1, + "qwerty": Test.MyEnum.enum3, + "Hello!!": Test.MyEnum.enum2, + }, ) dsi2 = ({"Goodbye": Test.MyEnum.enum1},) @@ -1100,8 +1127,11 @@ def twowaysFuture(helper, p): p.opStringMyEnumDSAsync(dsi1, dsi2).add_done_callback(cb.opStringMyEnumDS) cb.called() - dsi1 = ({Test.MyEnum.enum1: 'abc'}, {Test.MyEnum.enum2: 'Hello!!', Test.MyEnum.enum3: 'qwerty'}) - dsi2 = ({Test.MyEnum.enum1: 'Goodbye'},) + dsi1 = ( + {Test.MyEnum.enum1: "abc"}, + {Test.MyEnum.enum2: "Hello!!", Test.MyEnum.enum3: "qwerty"}, + ) + dsi2 = ({Test.MyEnum.enum1: "Goodbye"},) cb = Callback() p.opMyEnumStringDSAsync(dsi1, dsi2).add_done_callback(cb.opMyEnumStringDS) @@ -1115,7 +1145,7 @@ def twowaysFuture(helper, p): dsi1 = ( {s11: Test.MyEnum.enum1, s12: Test.MyEnum.enum2}, - {s11: Test.MyEnum.enum1, s22: Test.MyEnum.enum3, s23: Test.MyEnum.enum2} + {s11: Test.MyEnum.enum1, s22: Test.MyEnum.enum3, s23: Test.MyEnum.enum2}, ) dsi2 = ({s23: Test.MyEnum.enum3},) @@ -1124,7 +1154,7 @@ def twowaysFuture(helper, p): cb.called() sdi1 = {0x01: (0x01, 0x11), 0x22: (0x12,)} - sdi2 = {0xf1: (0xf2, 0xf3)} + sdi2 = {0xF1: (0xF2, 0xF3)} cb = Callback() p.opByteByteSDAsync(sdi1, sdi2).add_done_callback(cb.opByteByteSD) @@ -1151,7 +1181,10 @@ def twowaysFuture(helper, p): p.opIntIntSDAsync(sdi1, sdi2).add_done_callback(cb.opIntIntSD) cb.called() - sdi1 = {999999990: (999999110, 999999111, 999999110), 999999991: (999999120, 999999130)} + sdi1 = { + 999999990: (999999110, 999999111, 999999110), + 999999991: (999999120, 999999130), + } sdi2 = {999999992: (999999110, 999999120)} cb = Callback() @@ -1165,8 +1198,8 @@ def twowaysFuture(helper, p): p.opStringFloatSDAsync(sdi1, sdi2).add_done_callback(cb.opStringFloatSD) cb.called() - sdi1 = {"Hello!!": (1.1E10, 1.2E10, 1.3E10), "Goodbye": (1.4E10, 1.5E10)} - sdi2 = {"": (1.6E10, 1.7E10)} + sdi1 = {"Hello!!": (1.1e10, 1.2e10, 1.3e10), "Goodbye": (1.4e10, 1.5e10)} + sdi2 = {"": (1.6e10, 1.7e10)} cb = Callback() p.opStringDoubleSDAsync(sdi1, sdi2).add_done_callback(cb.opStringDoubleSD) @@ -1181,7 +1214,7 @@ def twowaysFuture(helper, p): sdi1 = { Test.MyEnum.enum3: (Test.MyEnum.enum1, Test.MyEnum.enum1, Test.MyEnum.enum2), - Test.MyEnum.enum2: (Test.MyEnum.enum1, Test.MyEnum.enum2) + Test.MyEnum.enum2: (Test.MyEnum.enum1, Test.MyEnum.enum2), } sdi2 = {Test.MyEnum.enum1: (Test.MyEnum.enum3, Test.MyEnum.enum3)} @@ -1190,15 +1223,15 @@ def twowaysFuture(helper, p): cb.called() lengths = (0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000) - for l in lengths: + for length in lengths: s = [] - for i in range(l): + for i in range(length): s.append(i) - cb = Callback(l) + cb = Callback(length) p.opIntSAsync(s).add_done_callback(cb.opIntS) cb.check() - ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'} + ctx = {"one": "ONE", "two": "TWO", "three": "THREE"} test(len(p.ice_getContext()) == 0) f = p.opContextAsync() @@ -1224,16 +1257,18 @@ def twowaysFuture(helper, p): # Test implicit context propagation # if p.ice_getConnection(): - impls = ('Shared', 'PerThread') + impls = ("Shared", "PerThread") for i in impls: initData = Ice.InitializationData() initData.properties = communicator.getProperties().clone() - initData.properties.setProperty('Ice.ImplicitContext', i) + initData.properties.setProperty("Ice.ImplicitContext", i) ic = Ice.initialize(data=initData) - ctx = {'one': 'ONE', 'two': 'TWO', 'three': 'THREE'} + ctx = {"one": "ONE", "two": "TWO", "three": "THREE"} - p3 = Test.MyClassPrx.uncheckedCast(ic.stringToProxy("test:{0}".format(helper.getTestEndpoint()))) + p3 = Test.MyClassPrx.uncheckedCast( + ic.stringToProxy("test:{0}".format(helper.getTestEndpoint())) + ) ic.getImplicitContext().setContext(ctx) test(ic.getImplicitContext().getContext() == ctx) @@ -1241,19 +1276,19 @@ def twowaysFuture(helper, p): c = f.result() test(c == ctx) - ic.getImplicitContext().put('zero', 'ZERO') + ic.getImplicitContext().put("zero", "ZERO") ctx = ic.getImplicitContext().getContext() f = p3.opContextAsync() c = f.result() test(c == ctx) - prxContext = {'one': 'UN', 'four': 'QUATRE'} + prxContext = {"one": "UN", "four": "QUATRE"} combined = {} combined.update(ctx) combined.update(prxContext) - test(combined['one'] == 'UN') + test(combined["one"] == "UN") p3 = Test.MyClassPrx.uncheckedCast(p3.ice_context(prxContext)) ic.getImplicitContext().setContext({}) diff --git a/python/test/Ice/optional/AllTests.py b/python/test/Ice/optional/AllTests.py index 5f57214f27c..8f8fe70e571 100644 --- a/python/test/Ice/optional/AllTests.py +++ b/python/test/Ice/optional/AllTests.py @@ -9,7 +9,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): @@ -74,18 +74,40 @@ def allTests(helper, communicator): ss = Test.SmallStruct() fs = Test.FixedStruct(78) vs = Test.VarStruct("hello") - mo1 = Test.MultiOptional(15, True, 19, 78, 99, 5.5, 1.0, "test", Test.MyEnum.MyEnumMember, - Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test")), - None, [5], ["test", "test2"], {4: 3}, {"test": 10}, fs, vs, [1], - [Test.MyEnum.MyEnumMember, Test.MyEnum.MyEnumMember], - [fs], [vs], [oo1], - [Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test"))], - {4: Test.MyEnum.MyEnumMember}, {4: fs}, {5: vs}, {5: Test.OneOptional(15)}, - {5: Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test"))}, - [False, True, False]) + mo1 = Test.MultiOptional( + 15, + True, + 19, + 78, + 99, + 5.5, + 1.0, + "test", + Test.MyEnum.MyEnumMember, + Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test")), + None, + [5], + ["test", "test2"], + {4: 3}, + {"test": 10}, + fs, + vs, + [1], + [Test.MyEnum.MyEnumMember, Test.MyEnum.MyEnumMember], + [fs], + [vs], + [oo1], + [Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test"))], + {4: Test.MyEnum.MyEnumMember}, + {4: fs}, + {5: vs}, + {5: Test.OneOptional(15)}, + {5: Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test"))}, + [False, True, False], + ) test(mo1.a == 15) - test(mo1.b == True) + test(mo1.b is True) test(mo1.c == 19) test(mo1.d == 78) test(mo1.e == 99) @@ -94,7 +116,7 @@ def allTests(helper, communicator): test(mo1.h == "test") test(mo1.i == Test.MyEnum.MyEnumMember) test(mo1.j == communicator.stringToProxy("test")) - test(mo1.k == None) + test(mo1.k is None) test(mo1.bs == [5]) test(mo1.ss == ["test", "test2"]) test(mo1.iid[4] == 3) @@ -103,7 +125,9 @@ def allTests(helper, communicator): test(mo1.vs == Test.VarStruct("hello")) test(mo1.shs[0] == 1) - test(mo1.es[0] == Test.MyEnum.MyEnumMember and mo1.es[1] == Test.MyEnum.MyEnumMember) + test( + mo1.es[0] == Test.MyEnum.MyEnumMember and mo1.es[1] == Test.MyEnum.MyEnumMember + ) test(mo1.fss[0] == Test.FixedStruct(78)) test(mo1.vss[0] == Test.VarStruct("hello")) test(mo1.oos[0] == oo1) @@ -193,7 +217,9 @@ def allTests(helper, communicator): test(mo5.fs == mo1.fs) test(mo5.vs == mo1.vs) test(mo5.shs == mo1.shs) - test(mo5.es[0] == Test.MyEnum.MyEnumMember and mo1.es[1] == Test.MyEnum.MyEnumMember) + test( + mo5.es[0] == Test.MyEnum.MyEnumMember and mo1.es[1] == Test.MyEnum.MyEnumMember + ) test(mo5.fss[0] == Test.FixedStruct(78)) test(mo5.vss[0] == Test.VarStruct("hello")) test(mo5.oos[0].a == 15) @@ -298,7 +324,9 @@ def allTests(helper, communicator): test(mo9.vs == mo1.vs) test(mo9.shs is Ice.Unset) - test(mo9.es[0] == Test.MyEnum.MyEnumMember and mo1.es[1] == Test.MyEnum.MyEnumMember) + test( + mo9.es[0] == Test.MyEnum.MyEnumMember and mo1.es[1] == Test.MyEnum.MyEnumMember + ) test(mo9.fss is Ice.Unset) test(mo9.vss[0] == Test.VarStruct("hello")) test(mo9.oos is Ice.Unset) @@ -316,7 +344,9 @@ def allTests(helper, communicator): # Use the 1.0 encoding with operations whose only class parameters are optional. # initial.sendOptionalClass(True, Test.OneOptional(53)) - initial.ice_encodingVersion(Ice.Encoding_1_0).sendOptionalClass(True, Test.OneOptional(53)) + initial.ice_encodingVersion(Ice.Encoding_1_0).sendOptionalClass( + True, Test.OneOptional(53) + ) r = initial.returnOptionalClass(True) test(r != Ice.Unset) @@ -347,7 +377,9 @@ def allTests(helper, communicator): print("ok") - sys.stdout.write("testing marshaling of large containers with fixed size elements... ") + sys.stdout.write( + "testing marshaling of large containers with fixed size elements... " + ) sys.stdout.flush() mc = Test.MultiOptional() @@ -469,10 +501,10 @@ def allTests(helper, communicator): (p2, p3) = initial.opBool(Ice.Unset) test(p2 is Ice.Unset and p3 is Ice.Unset) (p2, p3) = initial.opBool(True) - test(p2 == True and p3 == True) + test(p2 is True and p3 is True) f = initial.opBoolAsync(True) (p2, p3) = f.result() - test(p2 == True and p3 == True) + test(p2 is True and p3 is True) (p2, p3) = initial.opShort(Ice.Unset) test(p2 is Ice.Unset and p3 is Ice.Unset) @@ -769,7 +801,9 @@ def allTests(helper, communicator): # # Use the 1.0 encoding with an exception whose only class members are optional. # - initial.ice_encodingVersion(Ice.Encoding_1_0).opOptionalException(30, "test", Test.OneOptional(53)) + initial.ice_encodingVersion(Ice.Encoding_1_0).opOptionalException( + 30, "test", Test.OneOptional(53) + ) except Test.OptionalException as ex: test(ex.a is Ice.Unset) test(ex.b is Ice.Unset) @@ -804,7 +838,7 @@ def allTests(helper, communicator): test(ex.b is Ice.Unset) test(ex.o is Ice.Unset) test(ex.ss == "test") - test(ex.o2 == None) + test(ex.o2 is None) try: initial.opRequiredException(30, "test2", Test.OneOptional(53)) diff --git a/python/test/Ice/optional/Client.py b/python/test/Ice/optional/Client.py index d83697837a1..799e7ba2348 100755 --- a/python/test/Ice/optional/Client.py +++ b/python/test/Ice/optional/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("--all -I. ClientPrivate.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: initial = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/optional/Server.py b/python/test/Ice/optional/Server.py index 7fde66f0ab9..ec956caa9a0 100755 --- a/python/test/Ice/optional/Server.py +++ b/python/test/Ice/optional/Server.py @@ -4,13 +4,13 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import Test class InitialI(Test.Initial): - def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -189,10 +189,11 @@ def supportsNullOptional(self, current=None): class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") initial = InitialI() adapter.add(initial, Ice.stringToIdentity("initial")) diff --git a/python/test/Ice/optional/ServerAMD.py b/python/test/Ice/optional/ServerAMD.py index cb39c3a6646..9cfa2e93c84 100755 --- a/python/test/Ice/optional/ServerAMD.py +++ b/python/test/Ice/optional/ServerAMD.py @@ -4,13 +4,13 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import Test class InitialI(Test.Initial): - def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -149,28 +149,40 @@ def opVoid(self, current=None): return Ice.Future.completed(None) def opMStruct1(self, current): - return Ice.Future.completed(Test.Initial.OpMStruct1MarshaledResult(Test.SmallStruct(), current)) + return Ice.Future.completed( + Test.Initial.OpMStruct1MarshaledResult(Test.SmallStruct(), current) + ) def opMStruct2(self, p1, current): - return Ice.Future.completed(Test.Initial.OpMStruct2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.Initial.OpMStruct2MarshaledResult((p1, p1), current) + ) def opMSeq1(self, current): return Ice.Future.completed(Test.Initial.OpMSeq1MarshaledResult([], current)) def opMSeq2(self, p1, current): - return Ice.Future.completed(Test.Initial.OpMSeq2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.Initial.OpMSeq2MarshaledResult((p1, p1), current) + ) def opMDict1(self, current): return Ice.Future.completed(Test.Initial.OpMDict1MarshaledResult({}, current)) def opMDict2(self, p1, current): - return Ice.Future.completed(Test.Initial.OpMDict2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.Initial.OpMDict2MarshaledResult((p1, p1), current) + ) def opMG1(self, current): - return Ice.Future.completed(Test.Initial.OpMG1MarshaledResult(Test.G(), current)) + return Ice.Future.completed( + Test.Initial.OpMG1MarshaledResult(Test.G(), current) + ) def opMG2(self, p1, current): - return Ice.Future.completed(Test.Initial.OpMG2MarshaledResult((p1, p1), current)) + return Ice.Future.completed( + Test.Initial.OpMG2MarshaledResult((p1, p1), current) + ) def opRequiredAfterOptional(self, p1, p2, p3, current): return Ice.Future.completed((p1, p2, p3)) @@ -195,10 +207,11 @@ def supportsNullOptional(self, current=None): class ServerAMD(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") initial = InitialI() adapter.add(initial, Ice.stringToIdentity("initial")) diff --git a/python/test/Ice/packagemd/AllTests.py b/python/test/Ice/packagemd/AllTests.py index 4f2bf20a6aa..139d262062c 100644 --- a/python/test/Ice/packagemd/AllTests.py +++ b/python/test/Ice/packagemd/AllTests.py @@ -2,24 +2,19 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test import Test1 import testpkg import modpkg import sys -import threading -import time -import traceback def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): - sys.stdout.write("testing stringToProxy... ") sys.stdout.flush() ref = "initial:{0}".format(helper.getTestEndpoint()) @@ -49,13 +44,13 @@ def allTests(helper, communicator): try: initial.throwTest1E2AsE2() test(False) - except Test1.E2 as ex: + except Test1.E2: # Expected pass try: initial.throwTest1Def() test(False) - except Test1._def as ex: + except Test1._def: # Expected pass print("ok") @@ -76,7 +71,7 @@ def allTests(helper, communicator): try: initial.throwTest2E2AsE2() test(False) - except testpkg.Test2.E2 as ex: + except testpkg.Test2.E2: # Expected pass @@ -93,7 +88,7 @@ def allTests(helper, communicator): try: initial.throwTest3E2AsE2() test(False) - except modpkg.Test3.E2 as ex: + except modpkg.Test3.E2: # Expected pass diff --git a/python/test/Ice/packagemd/Client.py b/python/test/Ice/packagemd/Client.py index bf189642b13..3836c28631c 100755 --- a/python/test/Ice/packagemd/Client.py +++ b/python/test/Ice/packagemd/Client.py @@ -4,15 +4,15 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("--all -I. Test.ice") import AllTests class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) - properties.setProperty('Ice.Warn.Dispatch', '0') + properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: initial = AllTests.allTests(self, communicator) initial.shutdown() diff --git a/python/test/Ice/packagemd/Server.py b/python/test/Ice/packagemd/Server.py index f05141cc749..6d8a5dc150c 100755 --- a/python/test/Ice/packagemd/Server.py +++ b/python/test/Ice/packagemd/Server.py @@ -4,7 +4,8 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('--all -I. Test.ice') + +TestHelper.loadSlice("--all -I. Test.ice") import Test import Test1 import testpkg @@ -13,7 +14,6 @@ class InitialI(Test.Initial): - def getTest1C2AsObject(self, current): return Test1.C2() @@ -67,11 +67,11 @@ def shutdown(self, current): class Server(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(InitialI(), Ice.stringToIdentity("initial")) adapter.activate() diff --git a/python/test/Ice/properties/Client.py b/python/test/Ice/properties/Client.py index f4d023f3709..6b2e52f11a6 100644 --- a/python/test/Ice/properties/Client.py +++ b/python/test/Ice/properties/Client.py @@ -11,7 +11,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class App(Ice.Application): @@ -25,7 +25,6 @@ def run(self, args): class Client(TestHelper): - def run(sef, args): sys.stdout.write("testing load properties from UTF-8 path... ") sys.stdout.flush() @@ -37,7 +36,9 @@ def run(sef, args): test(properties.getProperty("Ice.ProgramName") == "PropertiesClient") print("ok") - sys.stdout.write("testing load properties from UTF-8 path using Ice::Application... ") + sys.stdout.write( + "testing load properties from UTF-8 path using Ice::Application... " + ) sys.stdout.flush() app = App() app.main(args, "./config/中国_client.config") @@ -45,7 +46,9 @@ def run(sef, args): sys.stdout.write("testing using Ice.Config with multiple config files... ") sys.stdout.flush() - properties = Ice.createProperties(["--Ice.Config=config/config.1, config/config.2, config/config.3"]) + properties = Ice.createProperties( + ["--Ice.Config=config/config.1, config/config.2, config/config.3"] + ) test(properties.getProperty("Config1") == "Config1") test(properties.getProperty("Config2") == "Config2") test(properties.getProperty("Config3") == "Config3") @@ -76,7 +79,7 @@ def run(sef, args): "B": "2 3 4", "C": "5=#6", "AServer": "\\\\server\\dir", - "BServer": "\\server\\dir" + "BServer": "\\server\\dir", } for k in props.keys(): diff --git a/python/test/Ice/proxy/AllTests.py b/python/test/Ice/proxy/AllTests.py index aa0f6d66e92..6e5c9377fac 100644 --- a/python/test/Ice/proxy/AllTests.py +++ b/python/test/Ice/proxy/AllTests.py @@ -5,12 +5,11 @@ import Ice import Test import sys -import threading def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator, collocated): @@ -20,51 +19,79 @@ def allTests(helper, communicator, collocated): # # Test nil proxies. # - p = communicator.stringToProxy('') - test(p == None) - p = communicator.propertyToProxy('bogus') - test(p == None) + p = communicator.stringToProxy("") + test(p is None) + p = communicator.propertyToProxy("bogus") + test(p is None) ref = "test:{0}".format(helper.getTestEndpoint()) base = communicator.stringToProxy(ref) test(base) b1 = communicator.stringToProxy("test") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getAdapterId()) == 0 and len(b1.ice_getFacet()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getAdapterId()) == 0 + and len(b1.ice_getFacet()) == 0 + ) b1 = communicator.stringToProxy("test ") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) b1 = communicator.stringToProxy(" test ") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) b1 = communicator.stringToProxy(" test") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) b1 = communicator.stringToProxy("'test -f facet'") - test(b1.ice_getIdentity().name == "test -f facet" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) + test( + b1.ice_getIdentity().name == "test -f facet" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) try: b1 = communicator.stringToProxy("\"test -f facet'") test(False) except Ice.ProxyParseException: pass - b1 = communicator.stringToProxy("\"test -f facet\"") - test(b1.ice_getIdentity().name == "test -f facet" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) - b1 = communicator.stringToProxy("\"test -f facet@test\"") - test(b1.ice_getIdentity().name == "test -f facet@test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) - b1 = communicator.stringToProxy("\"test -f facet@test @test\"") - test(b1.ice_getIdentity().name == "test -f facet@test @test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getFacet()) == 0) + b1 = communicator.stringToProxy('"test -f facet"') + test( + b1.ice_getIdentity().name == "test -f facet" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) + b1 = communicator.stringToProxy('"test -f facet@test"') + test( + b1.ice_getIdentity().name == "test -f facet@test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) + b1 = communicator.stringToProxy('"test -f facet@test @test"') + test( + b1.ice_getIdentity().name == "test -f facet@test @test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getFacet()) == 0 + ) try: b1 = communicator.stringToProxy("test test") test(False) except Ice.ProxyParseException: pass b1 = communicator.stringToProxy("test\\040test") - test(b1.ice_getIdentity().name == "test test" and len(b1.ice_getIdentity().category) == 0) + test( + b1.ice_getIdentity().name == "test test" + and len(b1.ice_getIdentity().category) == 0 + ) try: b1 = communicator.stringToProxy("test\\777") test(False) @@ -84,82 +111,143 @@ def allTests(helper, communicator, collocated): test(b1.ice_getIdentity().name == "test\1114test") b1 = communicator.stringToProxy("test\\b\\f\\n\\r\\t\\'\\\"\\\\test") - test(b1.ice_getIdentity().name == "test\b\f\n\r\t\'\"\\test" and len(b1.ice_getIdentity().category) == 0) + test( + b1.ice_getIdentity().name == "test\b\f\n\r\t'\"\\test" + and len(b1.ice_getIdentity().category) == 0 + ) b1 = communicator.stringToProxy("category/test") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category" and - len(b1.ice_getAdapterId()) == 0) + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category" + and len(b1.ice_getAdapterId()) == 0 + ) - b1 = communicator.stringToProxy("test:tcp --sourceAddress \"::1\"") + b1 = communicator.stringToProxy('test:tcp --sourceAddress "::1"') test(b1 == communicator.stringToProxy(b1.ice_toString())) - b1 = communicator.stringToProxy("test:udp --sourceAddress \"::1\" --interface \"0:0:0:0:0:0:0:1%lo\"") + b1 = communicator.stringToProxy( + 'test:udp --sourceAddress "::1" --interface "0:0:0:0:0:0:0:1%lo"' + ) test(b1 == communicator.stringToProxy(b1.ice_toString())) b1 = communicator.stringToProxy("test@adapter") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getAdapterId() == "adapter") + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getAdapterId() == "adapter" + ) try: b1 = communicator.stringToProxy("id@adapter test") test(False) except Ice.ProxyParseException: pass b1 = communicator.stringToProxy("category/test@adapter") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category" and - b1.ice_getAdapterId() == "adapter") + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category" + and b1.ice_getAdapterId() == "adapter" + ) b1 = communicator.stringToProxy("category/test@adapter:tcp") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category" and - b1.ice_getAdapterId() == "adapter:tcp") + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category" + and b1.ice_getAdapterId() == "adapter:tcp" + ) b1 = communicator.stringToProxy("'category 1/test'@adapter") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category 1" and - b1.ice_getAdapterId() == "adapter") + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category 1" + and b1.ice_getAdapterId() == "adapter" + ) b1 = communicator.stringToProxy("'category/test 1'@adapter") - test(b1.ice_getIdentity().name == "test 1" and b1.ice_getIdentity().category == "category" and - b1.ice_getAdapterId() == "adapter") + test( + b1.ice_getIdentity().name == "test 1" + and b1.ice_getIdentity().category == "category" + and b1.ice_getAdapterId() == "adapter" + ) b1 = communicator.stringToProxy("'category/test'@'adapter 1'") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category" and - b1.ice_getAdapterId() == "adapter 1") - b1 = communicator.stringToProxy("\"category \\/test@foo/test\"@adapter") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category /test@foo" and - b1.ice_getAdapterId() == "adapter") - b1 = communicator.stringToProxy("\"category \\/test@foo/test\"@\"adapter:tcp\"") - test(b1.ice_getIdentity().name == "test" and b1.ice_getIdentity().category == "category /test@foo" and - b1.ice_getAdapterId() == "adapter:tcp") + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category" + and b1.ice_getAdapterId() == "adapter 1" + ) + b1 = communicator.stringToProxy('"category \\/test@foo/test"@adapter') + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category /test@foo" + and b1.ice_getAdapterId() == "adapter" + ) + b1 = communicator.stringToProxy('"category \\/test@foo/test"@"adapter:tcp"') + test( + b1.ice_getIdentity().name == "test" + and b1.ice_getIdentity().category == "category /test@foo" + and b1.ice_getAdapterId() == "adapter:tcp" + ) b1 = communicator.stringToProxy("id -f facet") - test(b1.ice_getIdentity().name == "id" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet") + test( + b1.ice_getIdentity().name == "id" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet" + ) b1 = communicator.stringToProxy("id -f 'facet x'") - test(b1.ice_getIdentity().name == "id" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet x") - b1 = communicator.stringToProxy("id -f \"facet x\"") - test(b1.ice_getIdentity().name == "id" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet x") + test( + b1.ice_getIdentity().name == "id" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet x" + ) + b1 = communicator.stringToProxy('id -f "facet x"') + test( + b1.ice_getIdentity().name == "id" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet x" + ) try: - b1 = communicator.stringToProxy("id -f \"facet x") + b1 = communicator.stringToProxy('id -f "facet x') test(False) except Ice.ProxyParseException: pass try: - b1 = communicator.stringToProxy("id -f \'facet x") + b1 = communicator.stringToProxy("id -f 'facet x") test(False) except Ice.ProxyParseException: pass b1 = communicator.stringToProxy("test -f facet:tcp") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet" and len(b1.ice_getAdapterId()) == 0) - b1 = communicator.stringToProxy("test -f \"facet:tcp\"") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet:tcp" and len(b1.ice_getAdapterId()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet" + and len(b1.ice_getAdapterId()) == 0 + ) + b1 = communicator.stringToProxy('test -f "facet:tcp"') + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet:tcp" + and len(b1.ice_getAdapterId()) == 0 + ) b1 = communicator.stringToProxy("test -f facet@test") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet" and b1.ice_getAdapterId() == "test") + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet" + and b1.ice_getAdapterId() == "test" + ) b1 = communicator.stringToProxy("test -f 'facet@test'") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet@test" and len(b1.ice_getAdapterId()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet@test" + and len(b1.ice_getAdapterId()) == 0 + ) b1 = communicator.stringToProxy("test -f 'facet@test'@test") - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - b1.ice_getFacet() == "facet@test" and b1.ice_getAdapterId() == "test") + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and b1.ice_getFacet() == "facet@test" + and b1.ice_getAdapterId() == "test" + ) try: b1 = communicator.stringToProxy("test -f facet@test @test") test(False) @@ -207,14 +295,20 @@ def allTests(helper, communicator, collocated): propertyPrefix = "Foo.Proxy" prop.setProperty(propertyPrefix, "test:{0}".format(helper.getTestEndpoint())) b1 = communicator.propertyToProxy(propertyPrefix) - test(b1.ice_getIdentity().name == "test" and len(b1.ice_getIdentity().category) == 0 and - len(b1.ice_getAdapterId()) == 0 and len(b1.ice_getFacet()) == 0) + test( + b1.ice_getIdentity().name == "test" + and len(b1.ice_getIdentity().category) == 0 + and len(b1.ice_getAdapterId()) == 0 + and len(b1.ice_getFacet()) == 0 + ) property = propertyPrefix + ".Locator" test(not b1.ice_getLocator()) prop.setProperty(property, "locator:default -p 10000") b1 = communicator.propertyToProxy(propertyPrefix) - test(b1.ice_getLocator() and b1.ice_getLocator().ice_getIdentity().name == "locator") + test( + b1.ice_getLocator() and b1.ice_getLocator().ice_getIdentity().name == "locator" + ) prop.setProperty(property, "") property = propertyPrefix + ".LocatorCacheTimeout" @@ -229,7 +323,9 @@ def allTests(helper, communicator, collocated): property = propertyPrefix + ".Locator" prop.setProperty(property, "locator:default -p 10000") b1 = communicator.propertyToProxy(propertyPrefix) - test(b1.ice_getLocator() and b1.ice_getLocator().ice_getIdentity().name == "locator") + test( + b1.ice_getLocator() and b1.ice_getLocator().ice_getIdentity().name == "locator" + ) prop.setProperty(property, "") property = propertyPrefix + ".LocatorCacheTimeout" @@ -242,10 +338,10 @@ def allTests(helper, communicator, collocated): # This cannot be tested so easily because the property is cached # on communicator initialization. # - #prop.setProperty("Ice.Default.LocatorCacheTimeout", "60") - #b1 = communicator.propertyToProxy(propertyPrefix) - #test(b1.ice_getLocatorCacheTimeout() == 60) - #prop.setProperty("Ice.Default.LocatorCacheTimeout", "") + # prop.setProperty("Ice.Default.LocatorCacheTimeout", "60") + # b1 = communicator.propertyToProxy(propertyPrefix) + # test(b1.ice_getLocatorCacheTimeout() == 60) + # prop.setProperty("Ice.Default.LocatorCacheTimeout", "") prop.setProperty(propertyPrefix, "test:{0}".format(helper.getTestEndpoint())) @@ -337,7 +433,10 @@ def allTests(helper, communicator, collocated): test(proxyProps["Test.LocatorCacheTimeout"] == "100") test(proxyProps["Test.InvocationTimeout"] == "1234") - test(proxyProps["Test.Locator"] == "locator -t -e " + Ice.encodingVersionToString(Ice.currentEncoding())) + test( + proxyProps["Test.Locator"] + == "locator -t -e " + Ice.encodingVersionToString(Ice.currentEncoding()) + ) test(proxyProps["Test.Locator.CollocationOptimized"] == "1") test(proxyProps["Test.Locator.ConnectionCached"] == "0") test(proxyProps["Test.Locator.PreferSecure"] == "1") @@ -345,7 +444,10 @@ def allTests(helper, communicator, collocated): test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300") test(proxyProps["Test.Locator.InvocationTimeout"] == "1500") - test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice.encodingVersionToString(Ice.currentEncoding())) + test( + proxyProps["Test.Locator.Router"] + == "router -t -e " + Ice.encodingVersionToString(Ice.currentEncoding()) + ) test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0") test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1") test(proxyProps["Test.Locator.Router.PreferSecure"] == "1") @@ -365,7 +467,12 @@ def allTests(helper, communicator, collocated): sys.stdout.write("testing proxy methods... ") sys.stdout.flush() - test(communicator.identityToString(base.ice_identity(Ice.stringToIdentity("other")).ice_getIdentity()) == "other") + test( + communicator.identityToString( + base.ice_identity(Ice.stringToIdentity("other")).ice_getIdentity() + ) + == "other" + ) # # Verify that ToStringMode is passed correctly @@ -405,9 +512,18 @@ def allTests(helper, communicator, collocated): test(not base.ice_collocationOptimized(False).ice_isCollocationOptimized()) test(base.ice_preferSecure(True).ice_isPreferSecure()) test(not base.ice_preferSecure(False).ice_isPreferSecure()) - test(base.ice_encodingVersion(Ice.Encoding_1_0).ice_getEncodingVersion() == Ice.Encoding_1_0) - test(base.ice_encodingVersion(Ice.Encoding_1_1).ice_getEncodingVersion() == Ice.Encoding_1_1) - test(base.ice_encodingVersion(Ice.Encoding_1_0).ice_getEncodingVersion() != Ice.Encoding_1_1) + test( + base.ice_encodingVersion(Ice.Encoding_1_0).ice_getEncodingVersion() + == Ice.Encoding_1_0 + ) + test( + base.ice_encodingVersion(Ice.Encoding_1_1).ice_getEncodingVersion() + == Ice.Encoding_1_1 + ) + test( + base.ice_encodingVersion(Ice.Encoding_1_0).ice_getEncodingVersion() + != Ice.Encoding_1_1 + ) try: base.ice_timeout(0) @@ -486,24 +602,46 @@ def allTests(helper, communicator, collocated): test(compObj.ice_secure(False) < compObj.ice_secure(True)) test(not (compObj.ice_secure(True) < compObj.ice_secure(False))) - test(compObj.ice_collocationOptimized(True) == compObj.ice_collocationOptimized(True)) - test(compObj.ice_collocationOptimized(False) != compObj.ice_collocationOptimized(True)) - test(compObj.ice_collocationOptimized(False) < compObj.ice_collocationOptimized(True)) - test(not (compObj.ice_collocationOptimized(True) < compObj.ice_collocationOptimized(False))) + test( + compObj.ice_collocationOptimized(True) == compObj.ice_collocationOptimized(True) + ) + test( + compObj.ice_collocationOptimized(False) + != compObj.ice_collocationOptimized(True) + ) + test( + compObj.ice_collocationOptimized(False) < compObj.ice_collocationOptimized(True) + ) + test( + not ( + compObj.ice_collocationOptimized(True) + < compObj.ice_collocationOptimized(False) + ) + ) test(compObj.ice_connectionCached(True) == compObj.ice_connectionCached(True)) test(compObj.ice_connectionCached(False) != compObj.ice_connectionCached(True)) test(compObj.ice_connectionCached(False) < compObj.ice_connectionCached(True)) test(not (compObj.ice_connectionCached(True) < compObj.ice_connectionCached(False))) - test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) == - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random)) - test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) != - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)) - test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) < - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered)) - test(not (compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) < - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random))) + test( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) + == compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) + ) + test( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) + != compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) + ) + test( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) + < compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) + ) + test( + not ( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered) + < compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random) + ) + ) test(compObj.ice_connectionId("id2") == compObj.ice_connectionId("id2")) test(compObj.ice_connectionId("id1") != compObj.ice_connectionId("id2")) @@ -518,8 +656,8 @@ def allTests(helper, communicator, collocated): test(not (compObj.ice_compress(True) < compObj.ice_compress(False))) test(compObj.ice_getCompress() == Ice.Unset) - test(compObj.ice_compress(True).ice_getCompress() == True) - test(compObj.ice_compress(False).ice_getCompress() == False) + test(compObj.ice_compress(True).ice_getCompress() is True) + test(compObj.ice_compress(False).ice_getCompress() is False) test(compObj.ice_timeout(20) == compObj.ice_timeout(20)) test(compObj.ice_timeout(10) != compObj.ice_timeout(20)) @@ -530,8 +668,12 @@ def allTests(helper, communicator, collocated): test(compObj.ice_timeout(10).ice_getTimeout() == 10) test(compObj.ice_timeout(20).ice_getTimeout() == 20) - loc1 = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc1:default -p 10000")) - loc2 = Ice.LocatorPrx.uncheckedCast(communicator.stringToProxy("loc2:default -p 10000")) + loc1 = Ice.LocatorPrx.uncheckedCast( + communicator.stringToProxy("loc1:default -p 10000") + ) + loc2 = Ice.LocatorPrx.uncheckedCast( + communicator.stringToProxy("loc2:default -p 10000") + ) test(compObj.ice_locator(None) == compObj.ice_locator(None)) test(compObj.ice_locator(loc1) == compObj.ice_locator(loc1)) test(compObj.ice_locator(loc1) != compObj.ice_locator(None)) @@ -542,8 +684,12 @@ def allTests(helper, communicator, collocated): test(compObj.ice_locator(loc1) < compObj.ice_locator(loc2)) test(not (compObj.ice_locator(loc2) < compObj.ice_locator(loc1))) - rtr1 = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr1:default -p 10000")) - rtr2 = Ice.RouterPrx.uncheckedCast(communicator.stringToProxy("rtr2:default -p 10000")) + rtr1 = Ice.RouterPrx.uncheckedCast( + communicator.stringToProxy("rtr1:default -p 10000") + ) + rtr2 = Ice.RouterPrx.uncheckedCast( + communicator.stringToProxy("rtr2:default -p 10000") + ) test(compObj.ice_router(None) == compObj.ice_router(None)) test(compObj.ice_router(rtr1) == compObj.ice_router(rtr1)) test(compObj.ice_router(rtr1) != compObj.ice_router(None)) @@ -586,7 +732,11 @@ def allTests(helper, communicator, collocated): test(compObj1.ice_locatorCacheTimeout(20) == compObj1.ice_locatorCacheTimeout(20)) test(compObj1.ice_locatorCacheTimeout(10) != compObj1.ice_locatorCacheTimeout(20)) test(compObj1.ice_locatorCacheTimeout(10) < compObj1.ice_locatorCacheTimeout(20)) - test(not (compObj1.ice_locatorCacheTimeout(20) < compObj1.ice_locatorCacheTimeout(10))) + test( + not ( + compObj1.ice_locatorCacheTimeout(20) < compObj1.ice_locatorCacheTimeout(10) + ) + ) test(compObj1.ice_invocationTimeout(20) == compObj1.ice_invocationTimeout(20)) test(compObj1.ice_invocationTimeout(10) != compObj1.ice_invocationTimeout(20)) @@ -599,17 +749,40 @@ def allTests(helper, communicator, collocated): test(compObj1 < compObj2) test(not (compObj2 < compObj1)) - endpts1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints() - endpts2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001").ice_getEndpoints() + endpts1 = communicator.stringToProxy( + "foo:tcp -h 127.0.0.1 -p 10000" + ).ice_getEndpoints() + endpts2 = communicator.stringToProxy( + "foo:tcp -h 127.0.0.1 -p 10001" + ).ice_getEndpoints() test(endpts1 != endpts2) test(endpts1 < endpts2) test(not (endpts2 < endpts1)) - test(endpts1 == communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000").ice_getEndpoints()) - - test(compObj1.ice_encodingVersion(Ice.Encoding_1_0) == compObj1.ice_encodingVersion(Ice.Encoding_1_0)) - test(compObj1.ice_encodingVersion(Ice.Encoding_1_0) != compObj1.ice_encodingVersion(Ice.Encoding_1_1)) - test(compObj.ice_encodingVersion(Ice.Encoding_1_0) < compObj.ice_encodingVersion(Ice.Encoding_1_1)) - test(not (compObj.ice_encodingVersion(Ice.Encoding_1_1) < compObj.ice_encodingVersion(Ice.Encoding_1_0))) + test( + endpts1 + == communicator.stringToProxy( + "foo:tcp -h 127.0.0.1 -p 10000" + ).ice_getEndpoints() + ) + + test( + compObj1.ice_encodingVersion(Ice.Encoding_1_0) + == compObj1.ice_encodingVersion(Ice.Encoding_1_0) + ) + test( + compObj1.ice_encodingVersion(Ice.Encoding_1_0) + != compObj1.ice_encodingVersion(Ice.Encoding_1_1) + ) + test( + compObj.ice_encodingVersion(Ice.Encoding_1_0) + < compObj.ice_encodingVersion(Ice.Encoding_1_1) + ) + test( + not ( + compObj.ice_encodingVersion(Ice.Encoding_1_1) + < compObj.ice_encodingVersion(Ice.Encoding_1_0) + ) + ) baseConnection = base.ice_getConnection() if baseConnection: @@ -630,10 +803,10 @@ def allTests(helper, communicator, collocated): test(cl == base) test(derived == base) test(cl == derived) - test(Test.MyDerivedClassPrx.checkedCast(cl, "facet") == None) + test(Test.MyDerivedClassPrx.checkedCast(cl, "facet") is None) loc = Ice.LocatorPrx.checkedCast(base) - test(loc == None) + test(loc is None) # # Upcasting @@ -651,7 +824,7 @@ def allTests(helper, communicator, collocated): sys.stdout.flush() tccp = Test.MyClassPrx.checkedCast(base) c = tccp.getContext() - test(c == None or len(c) == 0) + test(c is None or len(c) == 0) c = {} c["one"] = "hello" @@ -664,8 +837,8 @@ def allTests(helper, communicator, collocated): sys.stdout.write("testing ice_fixed... ") sys.stdout.flush() connection = cl.ice_getConnection() - if connection != None: - test(cl.ice_isFixed() == False) + if connection is not None: + test(cl.ice_isFixed() is False) test(cl.ice_fixed(connection).ice_isFixed()) cl.ice_fixed(connection).getContext() test(cl.ice_secure(True).ice_fixed(connection).ice_isSecure()) @@ -677,14 +850,27 @@ def allTests(helper, communicator, collocated): test(len(cl.ice_fixed(connection).ice_getContext()) == 0) test(len(cl.ice_context(ctx).ice_fixed(connection).ice_getContext()) == 2) test(cl.ice_fixed(connection).ice_getInvocationTimeout() == -1) - test(cl.ice_invocationTimeout(10).ice_fixed(connection).ice_getInvocationTimeout() == 10) + test( + cl.ice_invocationTimeout(10) + .ice_fixed(connection) + .ice_getInvocationTimeout() + == 10 + ) test(cl.ice_fixed(connection).ice_getConnection() == connection) - test(cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() == connection) + test( + cl.ice_fixed(connection).ice_fixed(connection).ice_getConnection() + == connection + ) test(cl.ice_fixed(connection).ice_getTimeout() == Ice.Unset) fixedConnection = cl.ice_connectionId("ice_fixed").ice_getConnection() - test(cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() == fixedConnection) + test( + cl.ice_fixed(connection).ice_fixed(fixedConnection).ice_getConnection() + == fixedConnection + ) try: - cl.ice_secure(not connection.getEndpoint().getInfo().secure()).ice_fixed(connection).ice_ping() + cl.ice_secure(not connection.getEndpoint().getInfo().secure()).ice_fixed( + connection + ).ice_ping() except Ice.NoEndpointException: pass try: @@ -695,7 +881,7 @@ def allTests(helper, communicator, collocated): try: cl.ice_fixed(connection) test(False) - except: + except Exception: # Expected with null connection. pass print("ok") @@ -806,13 +992,20 @@ def allTests(helper, communicator, collocated): pass # Legal TCP endpoint expressed as opaque endpoint - p1 = communicator.stringToProxy("test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") + p1 = communicator.stringToProxy( + "test -e 1.1:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==" + ) pstr = communicator.proxyToString(p1) test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") # Opaque endpoint encoded with 1.1 encoding. - p2 = communicator.stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==") - test(communicator.proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000") + p2 = communicator.stringToProxy( + "test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==" + ) + test( + communicator.proxyToString(p2) + == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000" + ) if communicator.getProperties().getPropertyAsInt("Ice.IPv6") == 0: # Working? @@ -821,21 +1014,32 @@ def allTests(helper, communicator, collocated): # Two legal TCP endpoints expressed as opaque endpoints p1 = communicator.stringToProxy( - "test -e 1.0:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==") + "test -e 1.0:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -t 1 -e 1.0 -v CTEyNy4wLjAuMusuAAAQJwAAAA==" + ) pstr = communicator.proxyToString(p1) - test(pstr == "test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000") + test( + pstr + == "test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000" + ) # # Test that an SSL endpoint and a nonsense endpoint get written # back out as an opaque endpoint. # p1 = communicator.stringToProxy( - "test -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") + "test -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch" + ) pstr = communicator.proxyToString(p1) if ssl: - test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch") + test( + pstr + == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch" + ) elif tcp: - test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") + test( + pstr + == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch" + ) # # Try to invoke on the SSL endpoint to verify that we get a @@ -859,9 +1063,15 @@ def allTests(helper, communicator, collocated): p2 = derived.echo(p1) pstr = communicator.proxyToString(p2) if ssl: - test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch") + test( + pstr + == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001 -t infinite:opaque -t 99 -e 1.0 -v abch" + ) elif tcp: - test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch") + test( + pstr + == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch" + ) print("ok") diff --git a/python/test/Ice/proxy/Client.py b/python/test/Ice/proxy/Client.py index 6df8d09eee5..377286585e4 100755 --- a/python/test/Ice/proxy/Client.py +++ b/python/test/Ice/proxy/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: myClass = AllTests.allTests(self, communicator, False) diff --git a/python/test/Ice/proxy/Collocated.py b/python/test/Ice/proxy/Collocated.py index 38c019d677f..0c1e45b4896 100755 --- a/python/test/Ice/proxy/Collocated.py +++ b/python/test/Ice/proxy/Collocated.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI @@ -11,11 +12,11 @@ class Collocated(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) # adapter.activate() // Don't activate OA to ensure collocation is used. diff --git a/python/test/Ice/proxy/Server.py b/python/test/Ice/proxy/Server.py index afbcc9c2cab..7cf7e806ba1 100755 --- a/python/test/Ice/proxy/Server.py +++ b/python/test/Ice/proxy/Server.py @@ -6,19 +6,20 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") -import Test import TestI class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") properties.setProperty("Ice.Warn.Connections", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) diff --git a/python/test/Ice/proxy/ServerAMD.py b/python/test/Ice/proxy/ServerAMD.py index eea5e894dde..78f30e06744 100755 --- a/python/test/Ice/proxy/ServerAMD.py +++ b/python/test/Ice/proxy/ServerAMD.py @@ -5,9 +5,9 @@ import Ice from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Test -import TestI class MyDerivedClassI(Test.MyDerivedClass): @@ -34,7 +34,9 @@ def run(self, args): properties.setProperty("Ice.Warn.Connections", "0") properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(MyDerivedClassI(), Ice.stringToIdentity("test")) adapter.activate() diff --git a/python/test/Ice/proxy/TestI.py b/python/test/Ice/proxy/TestI.py index ffd0dea5d51..069039c0cc0 100644 --- a/python/test/Ice/proxy/TestI.py +++ b/python/test/Ice/proxy/TestI.py @@ -2,9 +2,7 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test -import time class MyDerivedClassI(Test.MyDerivedClass): diff --git a/python/test/Ice/scope/AllTests.py b/python/test/Ice/scope/AllTests.py index 0de0f045efe..2be35481c28 100644 --- a/python/test/Ice/scope/AllTests.py +++ b/python/test/Ice/scope/AllTests.py @@ -3,23 +3,21 @@ # import sys -import string -import re -import traceback -import Ice import Test import Inner def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): sys.stdout.write("test using same type name in different Slice modules... ") sys.stdout.flush() - i1 = Test.IPrx.checkedCast(communicator.stringToProxy("i1:{0}".format(helper.getTestEndpoint()))) + i1 = Test.IPrx.checkedCast( + communicator.stringToProxy("i1:{0}".format(helper.getTestEndpoint())) + ) s1 = Test.S(0) @@ -67,7 +65,9 @@ def allTests(helper, communicator): c = i1.opC1(Test.C1("C1")) test(c.s == "C1") - i2 = Test.Inner.Inner2.IPrx.checkedCast(communicator.stringToProxy("i2:{0}".format(helper.getTestEndpoint()))) + i2 = Test.Inner.Inner2.IPrx.checkedCast( + communicator.stringToProxy("i2:{0}".format(helper.getTestEndpoint())) + ) s1 = Test.Inner.Inner2.S(0) @@ -106,7 +106,9 @@ def allTests(helper, communicator): test(cmap2["a"].s == s1) test(cmap3["a"].s == s1) - i3 = Test.Inner.IPrx.checkedCast(communicator.stringToProxy("i3:{0}".format(helper.getTestEndpoint()))) + i3 = Test.Inner.IPrx.checkedCast( + communicator.stringToProxy("i3:{0}".format(helper.getTestEndpoint())) + ) s1 = Test.Inner.Inner2.S(0) @@ -145,7 +147,9 @@ def allTests(helper, communicator): test(cmap2["a"].s == s1) test(cmap3["a"].s == s1) - i4 = Inner.Test.Inner2.IPrx.checkedCast(communicator.stringToProxy("i4:{0}".format(helper.getTestEndpoint()))) + i4 = Inner.Test.Inner2.IPrx.checkedCast( + communicator.stringToProxy("i4:{0}".format(helper.getTestEndpoint())) + ) s1 = Test.S(0) diff --git a/python/test/Ice/scope/Client.py b/python/test/Ice/scope/Client.py index dc5eb59e999..c38c885efcd 100755 --- a/python/test/Ice/scope/Client.py +++ b/python/test/Ice/scope/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/scope/Server.py b/python/test/Ice/scope/Server.py index e63824e2d10..83ee467a3f3 100755 --- a/python/test/Ice/scope/Server.py +++ b/python/test/Ice/scope/Server.py @@ -4,14 +4,14 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import Test import Inner import Ice class I1(Test.I): - def opS(self, s1, current=None): return (s1, s1) @@ -44,7 +44,6 @@ def shutdown(self, current=None): class I2(Test.Inner.Inner2.I): - def opS(self, s1, current=None): return (s1, s1) @@ -68,7 +67,6 @@ def shutdown(self, current=None): class I3(Test.Inner.I): - def opS(self, s1, current=None): return (s1, s1) @@ -92,7 +90,6 @@ def shutdown(self, current=None): class I4(Inner.Test.Inner2.I): - def opS(self, s1, current=None): return (s1, s1) @@ -116,10 +113,11 @@ def shutdown(self, current=None): class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(I1(), Ice.stringToIdentity("i1")) adapter.add(I2(), Ice.stringToIdentity("i2")) diff --git a/python/test/Ice/servantLocator/AllTests.py b/python/test/Ice/servantLocator/AllTests.py index 0ec8e8afe57..d3ebe175d13 100644 --- a/python/test/Ice/servantLocator/AllTests.py +++ b/python/test/Ice/servantLocator/AllTests.py @@ -9,11 +9,10 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def testExceptions(obj): - try: obj.requestFailedException() test(False) @@ -21,7 +20,7 @@ def testExceptions(obj): test(ex.id == obj.ice_getIdentity()) test(ex.facet == obj.ice_getFacet()) test(ex.operation == "requestFailedException") - except: + except Exception: test(False) try: @@ -29,7 +28,7 @@ def testExceptions(obj): test(False) except Ice.UnknownUserException as ex: test(ex.unknown == "reason") - except: + except Exception: test(False) try: @@ -37,7 +36,7 @@ def testExceptions(obj): test(False) except Ice.UnknownLocalException as ex: test(ex.unknown == "reason") - except: + except Exception: test(False) try: @@ -56,15 +55,18 @@ def testExceptions(obj): pass except AttributeError: pass - except: + except Exception: test(False) try: obj.localException() test(False) except Ice.UnknownLocalException as ex: - test(ex.unknown.find("Ice.SocketException") >= 0 or ex.unknown.find("Ice::SocketException") >= 0) - except: + test( + ex.unknown.find("Ice.SocketException") >= 0 + or ex.unknown.find("Ice::SocketException") >= 0 + ) + except Exception: test(False) try: @@ -76,7 +78,7 @@ def testExceptions(obj): pass except AttributeError: pass - except: + except Exception: test(False) try: @@ -84,7 +86,7 @@ def testExceptions(obj): test(False) except Ice.UnknownException as ex: test(ex.unknown == "reason") - except: + except Exception: test(False) try: @@ -93,7 +95,7 @@ def testExceptions(obj): except Ice.UnknownUserException: # Operation doesn't throw, but locate() and finished() throw TestIntfUserException. pass - except: + except Exception: test(False) try: @@ -102,7 +104,7 @@ def testExceptions(obj): except Ice.UnknownUserException: # Operation doesn't throw, but locate() and finished() throw TestIntfUserException. pass - except: + except Exception: test(False) try: @@ -111,7 +113,7 @@ def testExceptions(obj): except Test.TestImpossibleException: # Operation doesn't throw, but locate() and finished() throw TestImpossibleException. pass - except: + except Exception: test(False) try: @@ -120,7 +122,7 @@ def testExceptions(obj): except Test.TestImpossibleException: # Operation throws TestIntfUserException, but locate() and finished() throw TestImpossibleException. pass - except: + except Exception: test(False) @@ -141,69 +143,91 @@ def allTests(helper, communicator): sys.stdout.write("testing ice_ids... ") sys.stdout.flush() try: - obj = communicator.stringToProxy("category/locate:{0}".format(helper.getTestEndpoint())) + obj = communicator.stringToProxy( + "category/locate:{0}".format(helper.getTestEndpoint()) + ) obj.ice_ids() test(False) except Ice.UnknownUserException as ex: test(ex.unknown == "::Test::TestIntfUserException") - except: + except Exception: test(False) try: - obj = communicator.stringToProxy("category/finished:{0}".format(helper.getTestEndpoint())) + obj = communicator.stringToProxy( + "category/finished:{0}".format(helper.getTestEndpoint()) + ) obj.ice_ids() test(False) except Ice.UnknownUserException as ex: test(ex.unknown == "::Test::TestIntfUserException") - except: + except Exception: test(False) print("ok") sys.stdout.write("testing servant locator... ") sys.stdout.flush() - base = communicator.stringToProxy("category/locate:{0}".format(helper.getTestEndpoint())) + base = communicator.stringToProxy( + "category/locate:{0}".format(helper.getTestEndpoint()) + ) obj = Test.TestIntfPrx.checkedCast(base) try: Test.TestIntfPrx.checkedCast( - communicator.stringToProxy("category/unknown:{0}".format(helper.getTestEndpoint()))) + communicator.stringToProxy( + "category/unknown:{0}".format(helper.getTestEndpoint()) + ) + ) except Ice.ObjectNotExistException: pass print("ok") sys.stdout.write("testing default servant locator... ") sys.stdout.flush() - base = communicator.stringToProxy("anothercat/locate:{0}".format(helper.getTestEndpoint())) + base = communicator.stringToProxy( + "anothercat/locate:{0}".format(helper.getTestEndpoint()) + ) obj = Test.TestIntfPrx.checkedCast(base) base = communicator.stringToProxy("locate:{0}".format(helper.getTestEndpoint())) obj = Test.TestIntfPrx.checkedCast(base) try: Test.TestIntfPrx.checkedCast( - communicator.stringToProxy("anothercat/unknown:{0}".format(helper.getTestEndpoint()))) + communicator.stringToProxy( + "anothercat/unknown:{0}".format(helper.getTestEndpoint()) + ) + ) except Ice.ObjectNotExistException: pass try: - Test.TestIntfPrx.checkedCast(communicator.stringToProxy("unknown:{0}".format(helper.getTestEndpoint()))) + Test.TestIntfPrx.checkedCast( + communicator.stringToProxy("unknown:{0}".format(helper.getTestEndpoint())) + ) except Ice.ObjectNotExistException: pass print("ok") sys.stdout.write("testing locate exceptions... ") sys.stdout.flush() - base = communicator.stringToProxy("category/locate:{0}".format(helper.getTestEndpoint())) + base = communicator.stringToProxy( + "category/locate:{0}".format(helper.getTestEndpoint()) + ) obj = Test.TestIntfPrx.checkedCast(base) testExceptions(obj) print("ok") sys.stdout.write("testing finished exceptions... ") sys.stdout.flush() - base = communicator.stringToProxy("category/finished:{0}".format(helper.getTestEndpoint())) + base = communicator.stringToProxy( + "category/finished:{0}".format(helper.getTestEndpoint()) + ) obj = Test.TestIntfPrx.checkedCast(base) testExceptions(obj) print("ok") sys.stdout.write("testing servant locator removal... ") sys.stdout.flush() - base = communicator.stringToProxy("test/activation:{0}".format(helper.getTestEndpoint())) + base = communicator.stringToProxy( + "test/activation:{0}".format(helper.getTestEndpoint()) + ) activation = Test.TestActivationPrx.checkedCast(base) activation.activateServantLocator(False) try: @@ -218,18 +242,22 @@ def allTests(helper, communicator): activation.activateServantLocator(True) try: obj.ice_ping() - except: + except Exception: test(False) print("ok") sys.stdout.write("testing invalid locate return values ... ") sys.stdout.flush() try: - communicator.stringToProxy("invalidReturnValue:{0}".format(helper.getTestEndpoint())).ice_ping() + communicator.stringToProxy( + "invalidReturnValue:{0}".format(helper.getTestEndpoint()) + ).ice_ping() except Ice.ObjectNotExistException: pass try: - communicator.stringToProxy("invalidReturnType:{0}".format(helper.getTestEndpoint())).ice_ping() + communicator.stringToProxy( + "invalidReturnType:{0}".format(helper.getTestEndpoint()) + ).ice_ping() except Ice.ObjectNotExistException: pass print("ok") diff --git a/python/test/Ice/servantLocator/Client.py b/python/test/Ice/servantLocator/Client.py index b37cfa4f2c5..0de1a6528dc 100755 --- a/python/test/Ice/servantLocator/Client.py +++ b/python/test/Ice/servantLocator/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: obj = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/servantLocator/Collocated.py b/python/test/Ice/servantLocator/Collocated.py index 0c758970be0..24ee505b7c6 100755 --- a/python/test/Ice/servantLocator/Collocated.py +++ b/python/test/Ice/servantLocator/Collocated.py @@ -4,7 +4,8 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import Ice import TestI import AllTests @@ -12,10 +13,11 @@ class Collocated(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) communicator.getProperties().setProperty("Ice.Warn.Dispatch", "0") adapter = communicator.createObjectAdapter("TestAdapter") @@ -23,7 +25,10 @@ def run(self, args): adapter.addServantLocator(TestI.ServantLocatorI("category"), "category") adapter.addServantLocator(TestI.ServantLocatorI(""), "") adapter.add(TestI.TestI(), Ice.stringToIdentity("asm")) - adapter.add(TestActivationI.TestActivationI(), Ice.stringToIdentity("test/activation")) + adapter.add( + TestActivationI.TestActivationI(), + Ice.stringToIdentity("test/activation"), + ) AllTests.allTests(self, communicator) diff --git a/python/test/Ice/servantLocator/Server.py b/python/test/Ice/servantLocator/Server.py index 3ab77208d58..4bffcbb2710 100755 --- a/python/test/Ice/servantLocator/Server.py +++ b/python/test/Ice/servantLocator/Server.py @@ -4,24 +4,29 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import Ice import TestI import TestActivationI class Server(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) communicator.getProperties().setProperty("Ice.Warn.Dispatch", "0") adapter = communicator.createObjectAdapter("TestAdapter") adapter.addServantLocator(TestI.ServantLocatorI("category"), "category") adapter.addServantLocator(TestI.ServantLocatorI(""), "") adapter.add(TestI.TestI(), Ice.stringToIdentity("asm")) - adapter.add(TestActivationI.TestActivationI(), Ice.stringToIdentity("test/activation")) + adapter.add( + TestActivationI.TestActivationI(), + Ice.stringToIdentity("test/activation"), + ) adapter.activate() adapter.waitForDeactivate() diff --git a/python/test/Ice/servantLocator/ServerAMD.py b/python/test/Ice/servantLocator/ServerAMD.py index f675a1ba3fd..818baee3150 100755 --- a/python/test/Ice/servantLocator/ServerAMD.py +++ b/python/test/Ice/servantLocator/ServerAMD.py @@ -4,24 +4,29 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import Ice import TestAMDI import TestActivationAMDI class ServerAMD(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) communicator.getProperties().setProperty("Ice.Warn.Dispatch", "0") adapter = communicator.createObjectAdapter("TestAdapter") adapter.addServantLocator(TestAMDI.ServantLocatorI("category"), "category") adapter.addServantLocator(TestAMDI.ServantLocatorI(""), "") adapter.add(TestAMDI.TestI(), Ice.stringToIdentity("asm")) - adapter.add(TestActivationAMDI.TestActivationAMDI(), Ice.stringToIdentity("test/activation")) + adapter.add( + TestActivationAMDI.TestActivationAMDI(), + Ice.stringToIdentity("test/activation"), + ) adapter.activate() adapter.waitForDeactivate() diff --git a/python/test/Ice/servantLocator/TestAMDI.py b/python/test/Ice/servantLocator/TestAMDI.py index cd936b2ad7c..93e257b24dc 100644 --- a/python/test/Ice/servantLocator/TestAMDI.py +++ b/python/test/Ice/servantLocator/TestAMDI.py @@ -2,21 +2,16 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os -import sys -import traceback -import time import Ice import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestI(Test.TestIntf): - def requestFailedException(self, current=None): return None @@ -78,7 +73,7 @@ def asyncException(self, current=None): # # We can't do this with futures. # - #f = Ice.Future() + # f = Ice.Future() # f.set_exception(Test.TestIntfUserException()) # return f raise Ice.ObjectNotExistException() @@ -89,7 +84,7 @@ def shutdown(self, current=None): class Cookie: def message(self): - return 'blahblah' + return "blahblah" class ServantLocatorI(Ice.ServantLocator): @@ -143,7 +138,7 @@ def finished(self, current, servant, cookie): self.exception(current) test(isinstance(cookie, Cookie)) - test(cookie.message() == 'blahblah') + test(cookie.message() == "blahblah") def deactivate(self, category): test(not self._deactivated) diff --git a/python/test/Ice/servantLocator/TestActivationAMDI.py b/python/test/Ice/servantLocator/TestActivationAMDI.py index 250152b2da4..b3962c35617 100644 --- a/python/test/Ice/servantLocator/TestActivationAMDI.py +++ b/python/test/Ice/servantLocator/TestActivationAMDI.py @@ -2,21 +2,17 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os -import sys -import traceback -import time -import Ice import Test import TestAMDI class TestActivationAMDI(Test.TestActivation): - def activateServantLocator(self, activate, current=None): - if (activate): + if activate: current.adapter.addServantLocator(TestAMDI.ServantLocatorI(""), "") - current.adapter.addServantLocator(TestAMDI.ServantLocatorI("category"), "category") + current.adapter.addServantLocator( + TestAMDI.ServantLocatorI("category"), "category" + ) else: locator = current.adapter.removeServantLocator("") locator.deactivate("") diff --git a/python/test/Ice/servantLocator/TestActivationI.py b/python/test/Ice/servantLocator/TestActivationI.py index d465d371e26..8a7eab001f8 100644 --- a/python/test/Ice/servantLocator/TestActivationI.py +++ b/python/test/Ice/servantLocator/TestActivationI.py @@ -2,21 +2,17 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os -import sys -import traceback -import time -import Ice import Test import TestI class TestActivationI(Test.TestActivation): - def activateServantLocator(self, activate, current=None): if activate: current.adapter.addServantLocator(TestI.ServantLocatorI(""), "") - current.adapter.addServantLocator(TestI.ServantLocatorI("category"), "category") + current.adapter.addServantLocator( + TestI.ServantLocatorI("category"), "category" + ) else: locator = current.adapter.removeServantLocator("") locator.deactivate("") diff --git a/python/test/Ice/servantLocator/TestI.py b/python/test/Ice/servantLocator/TestI.py index 4a5772bb3ed..8f9dfd8bbb3 100644 --- a/python/test/Ice/servantLocator/TestI.py +++ b/python/test/Ice/servantLocator/TestI.py @@ -2,21 +2,16 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import os -import sys -import traceback -import time import Ice import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestI(Test.TestIntf): - def requestFailedException(self, current=None): pass @@ -77,7 +72,7 @@ def shutdown(self, current=None): class Cookie: def message(self): - return 'blahblah' + return "blahblah" class ServantLocatorI(Ice.ServantLocator): @@ -131,7 +126,7 @@ def finished(self, current, servant, cookie): self.exception(current) test(isinstance(cookie, Cookie)) - test(cookie.message() == 'blahblah') + test(cookie.message() == "blahblah") def deactivate(self, category): test(not self._deactivated) diff --git a/python/test/Ice/slicing/exceptions/AllTests.py b/python/test/Ice/slicing/exceptions/AllTests.py index ffbc722e291..d7baf826485 100644 --- a/python/test/Ice/slicing/exceptions/AllTests.py +++ b/python/test/Ice/slicing/exceptions/AllTests.py @@ -7,13 +7,13 @@ import threading import sys -Ice.loadSlice('-I. --all ClientPrivate.ice') +Ice.loadSlice("-I. --all ClientPrivate.ice") import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CallbackBase: @@ -41,7 +41,7 @@ def exception_baseAsBase(self, f): except Test.Base as b: test(b.b == "Base.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) self.called() @@ -52,7 +52,7 @@ def exception_unknownDerivedAsBase(self, f): except Test.Base as b: test(b.b == "UnknownDerived.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) self.called() @@ -64,7 +64,7 @@ def exception_knownDerivedAsBase(self, f): test(k.b == "KnownDerived.b") test(k.kd == "KnownDerived.kd") test(k.ice_id() == "::Test::KnownDerived") - except: + except Exception: test(False) self.called() @@ -76,7 +76,7 @@ def exception_knownDerivedAsKnownDerived(self, f): test(k.b == "KnownDerived.b") test(k.kd == "KnownDerived.kd") test(k.ice_id() == "::Test::KnownDerived") - except: + except Exception: test(False) self.called() @@ -87,7 +87,7 @@ def exception_unknownIntermediateAsBase(self, f): except Test.Base as b: test(b.b == "UnknownIntermediate.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) self.called() @@ -99,7 +99,7 @@ def exception_knownIntermediateAsBase(self, f): test(ki.b == "KnownIntermediate.b") test(ki.ki == "KnownIntermediate.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) self.called() @@ -112,7 +112,7 @@ def exception_knownMostDerivedAsBase(self, f): test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_id() == "::Test::KnownMostDerived") - except: + except Exception: test(False) self.called() @@ -124,7 +124,7 @@ def exception_knownIntermediateAsKnownIntermediate(self, f): test(ki.b == "KnownIntermediate.b") test(ki.ki == "KnownIntermediate.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) self.called() @@ -137,7 +137,7 @@ def exception_knownMostDerivedAsKnownMostDerived(self, f): test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_id() == "::Test::KnownMostDerived") - except: + except Exception: test(False) self.called() @@ -150,7 +150,7 @@ def exception_knownMostDerivedAsKnownIntermediate(self, f): test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_id() == "::Test::KnownMostDerived") - except: + except Exception: test(False) self.called() @@ -162,7 +162,7 @@ def exception_unknownMostDerived1AsBase(self, f): test(ki.b == "UnknownMostDerived1.b") test(ki.ki == "UnknownMostDerived1.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) self.called() @@ -174,7 +174,7 @@ def exception_unknownMostDerived1AsKnownIntermediate(self, f): test(ki.b == "UnknownMostDerived1.b") test(ki.ki == "UnknownMostDerived1.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) self.called() @@ -185,7 +185,7 @@ def exception_unknownMostDerived2AsBase(self, f): except Test.Base as b: test(b.b == "UnknownMostDerived2.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) self.called() @@ -236,7 +236,7 @@ def allTests(helper, communicator): except Test.Base as b: test(b.b == "Base.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) print("ok") @@ -255,7 +255,7 @@ def allTests(helper, communicator): except Test.Base as b: test(b.b == "UnknownDerived.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) print("ok") @@ -275,7 +275,7 @@ def allTests(helper, communicator): test(k.b == "KnownDerived.b") test(k.kd == "KnownDerived.kd") test(k.ice_id() == "::Test::KnownDerived") - except: + except Exception: test(False) print("ok") @@ -295,14 +295,16 @@ def allTests(helper, communicator): test(k.b == "KnownDerived.b") test(k.kd == "KnownDerived.kd") test(k.ice_id() == "::Test::KnownDerived") - except: + except Exception: test(False) print("ok") sys.stdout.write("non-slicing of known derived as derived (AMI)... ") sys.stdout.flush() cb = Callback() - t.knownDerivedAsKnownDerivedAsync().add_done_callback(cb.exception_knownDerivedAsKnownDerived) + t.knownDerivedAsKnownDerivedAsync().add_done_callback( + cb.exception_knownDerivedAsKnownDerived + ) cb.check() print("ok") @@ -314,14 +316,16 @@ def allTests(helper, communicator): except Test.Base as b: test(b.b == "UnknownIntermediate.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) print("ok") sys.stdout.write("slicing of unknown intermediate as base (AMI)... ") sys.stdout.flush() cb = Callback() - t.unknownIntermediateAsBaseAsync().add_done_callback(cb.exception_unknownIntermediateAsBase) + t.unknownIntermediateAsBaseAsync().add_done_callback( + cb.exception_unknownIntermediateAsBase + ) cb.check() print("ok") @@ -334,14 +338,16 @@ def allTests(helper, communicator): test(ki.b == "KnownIntermediate.b") test(ki.ki == "KnownIntermediate.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) print("ok") sys.stdout.write("slicing of known intermediate as base (AMI)... ") sys.stdout.flush() cb = Callback() - t.knownIntermediateAsBaseAsync().add_done_callback(cb.exception_knownIntermediateAsBase) + t.knownIntermediateAsBaseAsync().add_done_callback( + cb.exception_knownIntermediateAsBase + ) cb.check() print("ok") @@ -355,14 +361,16 @@ def allTests(helper, communicator): test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_id() == "::Test::KnownMostDerived") - except: + except Exception: test(False) print("ok") sys.stdout.write("slicing of known most derived as base (AMI)... ") sys.stdout.flush() cb = Callback() - t.knownMostDerivedAsBaseAsync().add_done_callback(cb.exception_knownMostDerivedAsBase) + t.knownMostDerivedAsBaseAsync().add_done_callback( + cb.exception_knownMostDerivedAsBase + ) cb.check() print("ok") @@ -375,14 +383,16 @@ def allTests(helper, communicator): test(ki.b == "KnownIntermediate.b") test(ki.ki == "KnownIntermediate.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) print("ok") sys.stdout.write("non-slicing of known intermediate as intermediate (AMI)... ") sys.stdout.flush() cb = Callback() - t.knownIntermediateAsKnownIntermediateAsync().add_done_callback(cb.exception_knownIntermediateAsKnownIntermediate) + t.knownIntermediateAsKnownIntermediateAsync().add_done_callback( + cb.exception_knownIntermediateAsKnownIntermediate + ) cb.check() print("ok") @@ -396,14 +406,16 @@ def allTests(helper, communicator): test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_id() == "::Test::KnownMostDerived") - except: + except Exception: test(False) print("ok") sys.stdout.write("non-slicing of known most derived as intermediate (AMI)... ") sys.stdout.flush() cb = Callback() - t.knownMostDerivedAsKnownIntermediateAsync().add_done_callback(cb.exception_knownMostDerivedAsKnownIntermediate) + t.knownMostDerivedAsKnownIntermediateAsync().add_done_callback( + cb.exception_knownMostDerivedAsKnownIntermediate + ) cb.check() print("ok") @@ -417,14 +429,16 @@ def allTests(helper, communicator): test(kmd.ki == "KnownMostDerived.ki") test(kmd.kmd == "KnownMostDerived.kmd") test(kmd.ice_id() == "::Test::KnownMostDerived") - except: + except Exception: test(False) print("ok") sys.stdout.write("non-slicing of known most derived as most derived (AMI)... ") sys.stdout.flush() cb = Callback() - t.knownMostDerivedAsKnownMostDerivedAsync().add_done_callback(cb.exception_knownMostDerivedAsKnownMostDerived) + t.knownMostDerivedAsKnownMostDerivedAsync().add_done_callback( + cb.exception_knownMostDerivedAsKnownMostDerived + ) cb.check() print("ok") @@ -437,18 +451,24 @@ def allTests(helper, communicator): test(ki.b == "UnknownMostDerived1.b") test(ki.ki == "UnknownMostDerived1.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) print("ok") - sys.stdout.write("slicing of unknown most derived, known intermediate as base (AMI)... ") + sys.stdout.write( + "slicing of unknown most derived, known intermediate as base (AMI)... " + ) sys.stdout.flush() cb = Callback() - t.unknownMostDerived1AsBaseAsync().add_done_callback(cb.exception_unknownMostDerived1AsBase) + t.unknownMostDerived1AsBaseAsync().add_done_callback( + cb.exception_unknownMostDerived1AsBase + ) cb.check() print("ok") - sys.stdout.write("slicing of unknown most derived, known intermediate as intermediate... ") + sys.stdout.write( + "slicing of unknown most derived, known intermediate as intermediate... " + ) sys.stdout.flush() try: t.unknownMostDerived1AsKnownIntermediate() @@ -457,19 +477,24 @@ def allTests(helper, communicator): test(ki.b == "UnknownMostDerived1.b") test(ki.ki == "UnknownMostDerived1.ki") test(ki.ice_id() == "::Test::KnownIntermediate") - except: + except Exception: test(False) print("ok") - sys.stdout.write("slicing of unknown most derived, known intermediate as intermediate (AMI)... ") + sys.stdout.write( + "slicing of unknown most derived, known intermediate as intermediate (AMI)... " + ) sys.stdout.flush() cb = Callback() t.unknownMostDerived1AsKnownIntermediateAsync().add_done_callback( - cb.exception_unknownMostDerived1AsKnownIntermediate) + cb.exception_unknownMostDerived1AsKnownIntermediate + ) cb.check() print("ok") - sys.stdout.write("slicing of unknown most derived, unknown intermediate as base... ") + sys.stdout.write( + "slicing of unknown most derived, unknown intermediate as base... " + ) sys.stdout.flush() try: t.unknownMostDerived2AsBase() @@ -477,14 +502,18 @@ def allTests(helper, communicator): except Test.Base as b: test(b.b == "UnknownMostDerived2.b") test(b.ice_id() == "::Test::Base") - except: + except Exception: test(False) print("ok") - sys.stdout.write("slicing of unknown most derived, unknown intermediate as base (AMI)... ") + sys.stdout.write( + "slicing of unknown most derived, unknown intermediate as base (AMI)... " + ) sys.stdout.flush() cb = Callback() - t.unknownMostDerived2AsBaseAsync().add_done_callback(cb.exception_unknownMostDerived2AsBase) + t.unknownMostDerived2AsBaseAsync().add_done_callback( + cb.exception_unknownMostDerived2AsBase + ) cb.check() print("ok") @@ -506,7 +535,7 @@ def allTests(helper, communicator): test(t.ice_getEncodingVersion() != Ice.Encoding_1_0) except Ice.OperationNotExistException: pass - except: + except Exception: test(False) print("ok") @@ -554,7 +583,7 @@ def allTests(helper, communicator): test(ex.kpd == "derived") except Ice.OperationNotExistException: pass - except: + except Exception: test(False) try: @@ -566,7 +595,7 @@ def allTests(helper, communicator): test(ex.kpd == "derived") except Ice.OperationNotExistException: pass - except: + except Exception: test(False) try: @@ -592,7 +621,7 @@ def allTests(helper, communicator): test(ex.kpd == "derived") except Ice.OperationNotExistException: pass - except: + except Exception: test(False) try: @@ -618,7 +647,7 @@ def allTests(helper, communicator): test(ex.kpd == "derived") except Ice.OperationNotExistException: pass - except: + except Exception: test(False) adapter.destroy() diff --git a/python/test/Ice/slicing/exceptions/Client.py b/python/test/Ice/slicing/exceptions/Client.py index a06c30643df..94267852a14 100755 --- a/python/test/Ice/slicing/exceptions/Client.py +++ b/python/test/Ice/slicing/exceptions/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: initial = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/slicing/exceptions/Server.py b/python/test/Ice/slicing/exceptions/Server.py index 4ab7b41385e..a4cc3ca030d 100755 --- a/python/test/Ice/slicing/exceptions/Server.py +++ b/python/test/Ice/slicing/exceptions/Server.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice import Test @@ -157,8 +158,9 @@ def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", - "{0} -t 10000".format(self.getTestEndpoint())) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", "{0} -t 10000".format(self.getTestEndpoint()) + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI(), Ice.stringToIdentity("Test")) adapter.activate() diff --git a/python/test/Ice/slicing/exceptions/ServerAMD.py b/python/test/Ice/slicing/exceptions/ServerAMD.py index 4a8d91ab47f..e9ce727c7f5 100755 --- a/python/test/Ice/slicing/exceptions/ServerAMD.py +++ b/python/test/Ice/slicing/exceptions/ServerAMD.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice import Test @@ -11,11 +12,10 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestI(Test.TestIntf): - def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() @@ -158,7 +158,9 @@ def knownPreservedAsKnownPreserved(self, r, current=None): def relayKnownPreservedAsBase(self, r, current): f = Ice.Future() try: - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) + p = Test.RelayPrx.uncheckedCast( + current.con.createProxy(r.ice_getIdentity()) + ) p.knownPreservedAsBase() test(False) except Ice.Exception as ex: @@ -168,7 +170,9 @@ def relayKnownPreservedAsBase(self, r, current): def relayKnownPreservedAsKnownPreserved(self, r, current): f = Ice.Future() try: - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) + p = Test.RelayPrx.uncheckedCast( + current.con.createProxy(r.ice_getIdentity()) + ) p.knownPreservedAsKnownPreserved() test(False) except Ice.Exception as ex: @@ -200,7 +204,9 @@ def unknownPreservedAsKnownPreserved(self, r, current=None): def relayUnknownPreservedAsBase(self, r, current): f = Ice.Future() try: - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) + p = Test.RelayPrx.uncheckedCast( + current.con.createProxy(r.ice_getIdentity()) + ) p.unknownPreservedAsBase() test(False) except Ice.Exception as ex: @@ -210,7 +216,9 @@ def relayUnknownPreservedAsBase(self, r, current): def relayUnknownPreservedAsKnownPreserved(self, r, current): f = Ice.Future() try: - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) + p = Test.RelayPrx.uncheckedCast( + current.con.createProxy(r.ice_getIdentity()) + ) p.unknownPreservedAsKnownPreserved() test(False) except Ice.Exception as ex: @@ -219,13 +227,13 @@ def relayUnknownPreservedAsKnownPreserved(self, r, current): class ServerAMD(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", - "{0} -t 10000".format(self.getTestEndpoint())) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", "{0} -t 10000".format(self.getTestEndpoint()) + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI(), Ice.stringToIdentity("Test")) adapter.activate() diff --git a/python/test/Ice/slicing/objects/AllTests.py b/python/test/Ice/slicing/objects/AllTests.py index 4a25ea67a81..159daccce51 100644 --- a/python/test/Ice/slicing/objects/AllTests.py +++ b/python/test/Ice/slicing/objects/AllTests.py @@ -8,13 +8,13 @@ import sys import threading -Ice.loadSlice('-I. --all ClientPrivate.ice') +Ice.loadSlice("-I. --all ClientPrivate.ice") import Test def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CallbackBase: @@ -169,7 +169,7 @@ def response_paramTest1(self, f): test(d1.pd1 == b2) test(b2) - test(b2.ice_id() == "::Test::B") # No factory, must be sliced + test(b2.ice_id() == "::Test::B") # No factory, must be sliced test(b2.sb == "D2.sb") test(b2.pb == b1) self.called() @@ -193,17 +193,17 @@ def response_paramTest3(self, f): (ret, p1, p2) = f.result() test(p1) test(p1.sb == "D2.sb (p1 1)") - test(p1.pb == None) + test(p1.pb is None) test(p1.ice_id() == "::Test::B") test(p2) test(p2.sb == "D2.sb (p2 1)") - test(p2.pb == None) + test(p2.pb is None) test(p2.ice_id() == "::Test::B") test(ret) test(ret.sb == "D1.sb (p2 2)") - test(ret.pb == None) + test(ret.pb is None) test(ret.ice_id() == "::Test::D1") self.called() @@ -211,12 +211,12 @@ def response_paramTest4(self, f): (ret, b) = f.result() test(b) test(b.sb == "D4.sb (1)") - test(b.pb == None) + test(b.pb is None) test(b.ice_id() == "::Test::B") test(ret) test(ret.sb == "B.sb (2)") - test(ret.pb == None) + test(ret.pb is None) test(ret.ice_id() == "::Test::B") self.called() @@ -456,7 +456,9 @@ def allTests(helper, communicator): sys.stdout.write("base with known derived as base (AMI)... ") sys.stdout.flush() cb = Callback() - t.SBSKnownDerivedAsSBaseAsync().add_done_callback(cb.response_SBSKnownDerivedAsSBase) + t.SBSKnownDerivedAsSBaseAsync().add_done_callback( + cb.response_SBSKnownDerivedAsSBase + ) cb.check() print("ok") @@ -472,7 +474,9 @@ def allTests(helper, communicator): sys.stdout.write("base with known derived as known derived (AMI)... ") sys.stdout.flush() cb = Callback() - t.SBSKnownDerivedAsSBSKnownDerivedAsync().add_done_callback(cb.response_SBSKnownDerivedAsSBSKnownDerived) + t.SBSKnownDerivedAsSBSKnownDerivedAsync().add_done_callback( + cb.response_SBSKnownDerivedAsSBSKnownDerived + ) cb.check() print("ok") @@ -492,7 +496,7 @@ def allTests(helper, communicator): test(sb.sb == "SBSUnknownDerived.sb") except Ice.OperationNotExistException: pass - except: + except Exception: test(False) else: try: @@ -507,21 +511,25 @@ def allTests(helper, communicator): except Ice.NoValueFactoryException: # Expected. pass - except: + except Exception: test(False) print("ok") sys.stdout.write("base with unknown derived as base (AMI)... ") sys.stdout.flush() cb = Callback() - t.SBSUnknownDerivedAsSBaseAsync().add_done_callback(cb.response_SBSUnknownDerivedAsSBase) + t.SBSUnknownDerivedAsSBaseAsync().add_done_callback( + cb.response_SBSUnknownDerivedAsSBase + ) cb.check() if t.ice_getEncodingVersion() == Ice.Encoding_1_0: # # This test succeeds for the 1.0 encoding. # cb = Callback() - t.SBSUnknownDerivedAsSBaseCompactAsync().add_done_callback(cb.response_SBSUnknownDerivedAsSBase) + t.SBSUnknownDerivedAsSBaseCompactAsync().add_done_callback( + cb.response_SBSUnknownDerivedAsSBase + ) cb.check() else: # @@ -529,7 +537,9 @@ def allTests(helper, communicator): # be sliced to a known type. # cb = Callback() - t.SBSUnknownDerivedAsSBaseCompactAsync().add_done_callback(cb.exception_SBSUnknownDerivedAsSBaseCompact) + t.SBSUnknownDerivedAsSBaseCompactAsync().add_done_callback( + cb.exception_SBSUnknownDerivedAsSBaseCompact + ) cb.check() print("ok") @@ -707,7 +717,7 @@ def allTests(helper, communicator): test(d1.pd1 == b2) test(b2) - test(b2.ice_id() == "::Test::B") # No factory, must be sliced + test(b2.ice_id() == "::Test::B") # No factory, must be sliced test(b2.sb == "D2.sb") test(b2.pb == b1) except Ice.Exception: @@ -736,7 +746,7 @@ def allTests(helper, communicator): test(d1.pd1 == b2) test(b2) - test(b2.ice_id() == "::Test::B") # No factory, must be sliced + test(b2.ice_id() == "::Test::B") # No factory, must be sliced test(b2.sb == "D2.sb") test(b2.pb == b1) except Ice.Exception: @@ -802,7 +812,7 @@ def allTests(helper, communicator): b2 = b1.pb test(b2) test(b2.sb == "D3.sb") - test(b2.ice_id() == "::Test::B") # Sliced by server + test(b2.ice_id() == "::Test::B") # Sliced by server test(b2.pb == b1) p3 = b2 test(not isinstance(p3, Test.D3)) @@ -845,7 +855,7 @@ def allTests(helper, communicator): b2 = b1.pb test(b2) test(b2.sb == "D3.sb") - test(b2.ice_id() == "::Test::B") # Sliced by server + test(b2.ice_id() == "::Test::B") # Sliced by server test(b2.pb == b1) p3 = b2 test(not isinstance(p3, Test.D3)) @@ -876,7 +886,7 @@ def allTests(helper, communicator): test(b1) test(b1.sb == "D3.sb") - test(b1.ice_id() == "::Test::B") # Sliced by server + test(b1.ice_id() == "::Test::B") # Sliced by server p1 = b1 test(not isinstance(p1, Test.D3)) @@ -919,7 +929,7 @@ def allTests(helper, communicator): test(b1) test(b1.sb == "D3.sb") - test(b1.ice_id() == "::Test::B") # Sliced by server + test(b1.ice_id() == "::Test::B") # Sliced by server p1 = b1 test(not isinstance(p1, Test.D3)) @@ -948,17 +958,17 @@ def allTests(helper, communicator): test(p1) test(p1.sb == "D2.sb (p1 1)") - test(p1.pb == None) + test(p1.pb is None) test(p1.ice_id() == "::Test::B") test(p2) test(p2.sb == "D2.sb (p2 1)") - test(p2.pb == None) + test(p2.pb is None) test(p2.ice_id() == "::Test::B") test(ret) test(ret.sb == "D1.sb (p2 2)") - test(ret.pb == None) + test(ret.pb is None) test(ret.ice_id() == "::Test::D1") except Ice.Exception: test(False) @@ -978,12 +988,12 @@ def allTests(helper, communicator): test(b) test(b.sb == "D4.sb (1)") - test(b.pb == None) + test(b.pb is None) test(b.ice_id() == "::Test::B") test(ret) test(ret.sb == "B.sb (2)") - test(ret.pb == None) + test(ret.pb is None) test(ret.ice_id() == "::Test::B") except Ice.Exception: test(False) @@ -996,7 +1006,9 @@ def allTests(helper, communicator): cb.check() print("ok") - sys.stdout.write("param ptr slicing, instance marshaled in unknown derived as base... ") + sys.stdout.write( + "param ptr slicing, instance marshaled in unknown derived as base... " + ) sys.stdout.flush() try: b1 = Test.B() @@ -1023,7 +1035,9 @@ def allTests(helper, communicator): test(False) print("ok") - sys.stdout.write("param ptr slicing, instance marshaled in unknown derived as base (AMI)... ") + sys.stdout.write( + "param ptr slicing, instance marshaled in unknown derived as base (AMI)... " + ) sys.stdout.flush() try: b1 = Test.B() @@ -1053,7 +1067,9 @@ def allTests(helper, communicator): test(False) print("ok") - sys.stdout.write("param ptr slicing, instance marshaled in unknown derived as derived... ") + sys.stdout.write( + "param ptr slicing, instance marshaled in unknown derived as derived... " + ) sys.stdout.flush() try: d11 = Test.D1() @@ -1083,7 +1099,9 @@ def allTests(helper, communicator): test(False) print("ok") - sys.stdout.write("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... ") + sys.stdout.write( + "param ptr slicing, instance marshaled in unknown derived as derived (AMI)... " + ) sys.stdout.flush() try: d11 = Test.D1() @@ -1305,7 +1323,7 @@ def allTests(helper, communicator): s = "D1." + str(i * 20) test(b.sb == s) if i == 0: - test(b.pb == None) + test(b.pb is None) else: test(b.pb == r[(i - 1) * 20]) d1 = b @@ -1353,7 +1371,7 @@ def allTests(helper, communicator): s = "D1." + str(i * 20) test(b.sb == s) if i == 0: - test(b.pb == None) + test(b.pb is None) else: test(b.pb == r[(i - 1) * 20]) d1 = b @@ -1460,7 +1478,9 @@ def allTests(helper, communicator): sys.stdout.write("unknown derived exception thrown as base exception (AMI)... ") sys.stdout.flush() cb = Callback() - t.throwUnknownDerivedAsBaseAsync().add_done_callback(cb.exception_throwUnknownDerivedAsBase) + t.throwUnknownDerivedAsBaseAsync().add_done_callback( + cb.exception_throwUnknownDerivedAsBase + ) cb.check() print("ok") @@ -1556,7 +1576,9 @@ def allTests(helper, communicator): for i in range(0, 300): p2 = Test.PCDerived2() p2.pi = i - p2.pbs = [None] # Nil reference. This slice should not have an indirection table. + p2.pbs = [ + None + ] # Nil reference. This slice should not have an indirection table. p2.pcd2 = i pcd.pbs.append(p2) pcd.pcd2 = pcd.pi @@ -1669,7 +1691,9 @@ def allTests(helper, communicator): for i in range(0, 300): p2 = Test.PCDerived2() p2.pi = i - p2.pbs = [None] # Nil reference. This slice should not have an indirection table. + p2.pbs = [ + None + ] # Nil reference. This slice should not have an indirection table. p2.pcd2 = i pcd.pbs.append(p2) pcd.pcd2 = pcd.pi @@ -1692,7 +1716,9 @@ def allTests(helper, communicator): # UCNode. This provides an easy way to determine how many # unmarshaled instances currently exist. # - communicator.getValueFactoryManager().add(NodeFactoryI, Test.PNode.ice_staticId()) + communicator.getValueFactoryManager().add( + NodeFactoryI, Test.PNode.ice_staticId() + ) # # Relay a graph through the server. This test uses a preserved class @@ -1701,16 +1727,16 @@ def allTests(helper, communicator): c = Test.PNode() c.next = Test.PNode() c.next.next = Test.PNode() - c.next.next.next = c # Create a cyclic graph. + c.next.next.next = c # Create a cyclic graph. test(PNodeI.counter == 0) n = t.exchangePNode(c) test(PNodeI.counter == 3) - test(n.next != None) + test(n.next is not None) test(n.next != n.next.next) test(n.next.next != n.next.next.next) test(n.next.next.next == n) - n = None # Release reference. + n = None # Release reference. gc.collect() test(PNodeI.counter == 0) @@ -1724,7 +1750,7 @@ def allTests(helper, communicator): test(p) test(PNodeI.counter == 3) t.checkPBSUnknownWithGraph(p) - p = None # Release reference. + p = None # Release reference. gc.collect() test(PNodeI.counter == 0) @@ -1733,7 +1759,9 @@ def allTests(helper, communicator): # Preserved. This provides an easy way to determine how many # unmarshaled instances currently exist. # - communicator.getValueFactoryManager().add(PreservedFactoryI, Test.Preserved.ice_staticId()) + communicator.getValueFactoryManager().add( + PreservedFactoryI, Test.Preserved.ice_staticId() + ) # # Obtain a preserved object from the server where the most-derived @@ -1744,11 +1772,11 @@ def allTests(helper, communicator): # test(PreservedI.counter == 0) p = t.PBSUnknown2AsPreservedWithGraph() - test(p != None) + test(p is not None) test(PreservedI.counter == 1) t.checkPBSUnknown2WithGraph(p) - p._ice_slicedData = None # Break the cycle. - p = None # Release reference. + p._ice_slicedData = None # Break the cycle. + p = None # Release reference. test(PreservedI.counter == 0) # @@ -1773,9 +1801,9 @@ def allTests(helper, communicator): # if t.ice_getEncodingVersion() != Ice.Encoding_1_0: test(PreservedI.counter == 1) - gc.collect() # No effect. + gc.collect() # No effect. test(PreservedI.counter == 1) - ex._ice_slicedData = None # Break the cycle. + ex._ice_slicedData = None # Break the cycle. # # Exception has gone out of scope. diff --git a/python/test/Ice/slicing/objects/Client.py b/python/test/Ice/slicing/objects/Client.py index 91f07a01c5d..77a0712527c 100755 --- a/python/test/Ice/slicing/objects/Client.py +++ b/python/test/Ice/slicing/objects/Client.py @@ -8,7 +8,6 @@ class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: initial = AllTests.allTests(self, communicator) diff --git a/python/test/Ice/slicing/objects/Server.py b/python/test/Ice/slicing/objects/Server.py index 3a233fb7e19..db4067d398a 100755 --- a/python/test/Ice/slicing/objects/Server.py +++ b/python/test/Ice/slicing/objects/Server.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice import Test @@ -11,7 +12,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestI(Test.TestIntf): @@ -265,7 +266,7 @@ def checkPBSUnknownWithGraph(self, p, current=None): test(p.graph != p.graph.next) test(p.graph.next != p.graph.next.next) test(p.graph.next.next.next == p.graph) - p.graph.next.next.next = None # Break the cycle. + p.graph.next.next.next = None # Break the cycle. def PBSUnknown2AsPreservedWithGraph(self, current=None): r = Test.PSUnknown2() @@ -285,7 +286,7 @@ def checkPBSUnknown2WithGraph(self, p, current=None): test(p.pi == 5) test(p.ps == "preserved") test(p.pb == p) - p.pb = None # Break the cycle. + p.pb = None # Break the cycle. def exchangePNode(self, pn, current=None): return pn @@ -362,13 +363,13 @@ def shutdown(self, current=None): class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", - "{0} -t 10000".format(self.getTestEndpoint())) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", "{0} -t 10000".format(self.getTestEndpoint()) + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI(), Ice.stringToIdentity("Test")) adapter.activate() diff --git a/python/test/Ice/slicing/objects/ServerAMD.py b/python/test/Ice/slicing/objects/ServerAMD.py index 77e3d3d0866..2607694a144 100755 --- a/python/test/Ice/slicing/objects/ServerAMD.py +++ b/python/test/Ice/slicing/objects/ServerAMD.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("-I. --all ServerPrivate.ice") import Ice import Test @@ -11,7 +12,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class TestI(Test.TestIntf): @@ -291,7 +292,7 @@ def checkPBSUnknownWithGraph(self, p, current=None): test(p.graph != p.graph.next) test(p.graph.next != p.graph.next.next) test(p.graph.next.next.next == p.graph) - p.graph.next.next.next = None # Break the cycle. + p.graph.next.next.next = None # Break the cycle. return Ice.Future.completed(None) def PBSUnknown2AsPreservedWithGraph(self, current=None): @@ -312,7 +313,7 @@ def checkPBSUnknown2WithGraph(self, p, current=None): test(p.pi == 5) test(p.ps == "preserved") test(p.pb == p) - p.pb = None # Break the cycle. + p.pb = None # Break the cycle. return Ice.Future.completed(None) def exchangePNode(self, pn, current=None): @@ -402,8 +403,9 @@ def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Dispatch", "0") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", - "{0} -t 10000".format(self.getTestEndpoint())) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", "{0} -t 10000".format(self.getTestEndpoint()) + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI(), Ice.stringToIdentity("Test")) adapter.activate() diff --git a/python/test/Ice/thread/AllTests.py b/python/test/Ice/thread/AllTests.py index 57ec0df8a7c..b40908dbe16 100644 --- a/python/test/Ice/thread/AllTests.py +++ b/python/test/Ice/thread/AllTests.py @@ -2,21 +2,20 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice import Test import sys -import TestI def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(helper, communicator): - ref = "factory:{0} -t 10000".format(helper.getTestEndpoint()) - factory = Test.RemoteCommunicatorFactoryPrx.checkedCast(communicator.stringToProxy(ref)) + factory = Test.RemoteCommunicatorFactoryPrx.checkedCast( + communicator.stringToProxy(ref) + ) sys.stdout.write("testing thread hooks... ") sys.stdout.flush() diff --git a/python/test/Ice/thread/Client.py b/python/test/Ice/thread/Client.py index dc5eb59e999..c38c885efcd 100644 --- a/python/test/Ice/thread/Client.py +++ b/python/test/Ice/thread/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): with self.initialize(args=args) as communicator: AllTests.allTests(self, communicator) diff --git a/python/test/Ice/thread/Server.py b/python/test/Ice/thread/Server.py index cc1ede956af..0d092c4c38d 100644 --- a/python/test/Ice/thread/Server.py +++ b/python/test/Ice/thread/Server.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import Ice import TestI @@ -12,9 +13,12 @@ class Server(TestHelper): def run(self, args): with self.initialize(args=args) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", - "{0} -t 10000".format(self.getTestEndpoint())) + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", "{0} -t 10000".format(self.getTestEndpoint()) + ) adapter = communicator.createObjectAdapter("TestAdapter") - adapter.add(TestI.RemoteCommunicatorFactoryI(), Ice.stringToIdentity("factory")) + adapter.add( + TestI.RemoteCommunicatorFactoryI(), Ice.stringToIdentity("factory") + ) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/thread/TestI.py b/python/test/Ice/thread/TestI.py index 0752a47022f..e5f8d7a8b7f 100644 --- a/python/test/Ice/thread/TestI.py +++ b/python/test/Ice/thread/TestI.py @@ -82,7 +82,6 @@ def destroy(self, current=None): class RemoteCommunicatorFactoryI(Test.RemoteCommunicatorFactory): - def createCommunicator(self, props, current=None): # # Prepare the property set using the given properties. @@ -101,7 +100,9 @@ def createCommunicator(self, props, current=None): # communicator = Ice.initialize(init) - proxy = current.adapter.addWithUUID(RemoteCommunicatorI(communicator, init.threadHook)) + proxy = current.adapter.addWithUUID( + RemoteCommunicatorI(communicator, init.threadHook) + ) return Test.RemoteCommunicatorPrx.uncheckedCast(proxy) def shutdown(self, current=None): diff --git a/python/test/Ice/timeout/AllTests.py b/python/test/Ice/timeout/AllTests.py index db74d215d90..d3601471921 100644 --- a/python/test/Ice/timeout/AllTests.py +++ b/python/test/Ice/timeout/AllTests.py @@ -11,7 +11,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class CallbackBase: @@ -65,8 +65,11 @@ def connect(prx): def allTests(helper, communicator): controller = Test.ControllerPrx.checkedCast( - communicator.stringToProxy("controller:{0}".format(helper.getTestEndpoint(num=1)))) - test(controller != None) + communicator.stringToProxy( + "controller:{0}".format(helper.getTestEndpoint(num=1)) + ) + ) + test(controller is not None) try: allTestsWithController(helper, communicator, controller) @@ -78,13 +81,12 @@ def allTests(helper, communicator): def allTestsWithController(helper, communicator, controller): - sref = "timeout:{0}".format(helper.getTestEndpoint()) obj = communicator.stringToProxy(sref) - test(obj != None) + test(obj is not None) timeout = Test.TimeoutPrx.checkedCast(obj) - test(timeout != None) + test(timeout is not None) sys.stdout.write("testing connect timeout... ") sys.stdout.flush() diff --git a/python/test/Ice/timeout/Client.py b/python/test/Ice/timeout/Client.py index 50fd144268d..ffb9e0b1dcd 100755 --- a/python/test/Ice/timeout/Client.py +++ b/python/test/Ice/timeout/Client.py @@ -4,12 +4,12 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import AllTests class Client(TestHelper): - def run(self, args): # # In this test, we need at least two threads in the diff --git a/python/test/Ice/timeout/Server.py b/python/test/Ice/timeout/Server.py index 2e233620a49..39dc2de7a1e 100755 --- a/python/test/Ice/timeout/Server.py +++ b/python/test/Ice/timeout/Server.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Test.ice") import threading import time @@ -35,7 +36,6 @@ def sleep(self, timeout, current=None): class ControllerI(Test.Controller): - def __init__(self, adapter): self.adapter = adapter @@ -53,7 +53,6 @@ def shutdown(self, current=None): class Server(TestHelper): - def run(self, args): properties = self.createTestProperties(args) properties.setProperty("Ice.Warn.Connections", "0") @@ -71,16 +70,24 @@ def run(self, args): properties.setProperty("Ice.TCP.RcvSize", "50000") with self.initialize(properties=properties) as communicator: - communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", self.getTestEndpoint(num=1)) - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1") + communicator.getProperties().setProperty( + "TestAdapter.Endpoints", self.getTestEndpoint() + ) + communicator.getProperties().setProperty( + "ControllerAdapter.Endpoints", self.getTestEndpoint(num=1) + ) + communicator.getProperties().setProperty( + "ControllerAdapter.ThreadPool.Size", "1" + ) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TimeoutI(), Ice.stringToIdentity("timeout")) adapter.activate() controllerAdapter = communicator.createObjectAdapter("ControllerAdapter") - controllerAdapter.add(ControllerI(adapter), Ice.stringToIdentity("controller")) + controllerAdapter.add( + ControllerI(adapter), Ice.stringToIdentity("controller") + ) controllerAdapter.activate() communicator.waitForShutdown() diff --git a/python/test/Slice/escape/Client.py b/python/test/Slice/escape/Client.py index aecb703c08d..09dd432c550 100755 --- a/python/test/Slice/escape/Client.py +++ b/python/test/Slice/escape/Client.py @@ -4,6 +4,7 @@ # from TestHelper import TestHelper + TestHelper.loadSlice("Key.ice Clash.ice") import sys import Ice @@ -39,36 +40,35 @@ def _raise(self, _else, _return, _while, _yield, _or, _global): def testtypes(): sys.stdout.write("Testing generated type names... ") sys.stdout.flush() - a = _and._assert._break + _a = _and._assert._break b = _and._continue b._def = 0 - c = _and.delPrx.uncheckedCast(None) + _c = _and.delPrx.uncheckedCast(None) assert "_elif" in dir(_and.delPrx) - c1 = delI() - d = _and.execPrx.uncheckedCast(None) + _c1 = delI() + _d = _and.execPrx.uncheckedCast(None) assert "_finally" in dir(_and.execPrx) - d1 = execI() + _d1 = execI() - e1 = _and._for() - f = _and.ifPrx.uncheckedCast(None) + _e1 = _and._for() + _f = _and.ifPrx.uncheckedCast(None) assert "_finally" in dir(_and.ifPrx) assert "_elif" in dir(_and.ifPrx) - f1 = ifI() + _f1 = ifI() g = _and._is() g._lamba = 0 h = _and._not() h._lamba = 0 h._or = 1 h._pass = 2 - i = printI() - j = _and._lambda - en = _and.EnumNone._None + _i = printI() + _j = _and._lambda + _en = _and.EnumNone._None print("ok") class Client(TestHelper): - def run(self, args): properties = self.createTestProperties(args) # @@ -85,7 +85,9 @@ def run(self, args): sys.stdout.write("Testing operation name... ") sys.stdout.flush() - p = _and.execPrx.uncheckedCast(adapter.createProxy(Ice.stringToIdentity("test"))) + p = _and.execPrx.uncheckedCast( + adapter.createProxy(Ice.stringToIdentity("test")) + ) p._finally() print("ok") diff --git a/python/test/Slice/import/Client.py b/python/test/Slice/import/Client.py index e0d55c79818..cb06236b0a0 100755 --- a/python/test/Slice/import/Client.py +++ b/python/test/Slice/import/Client.py @@ -10,11 +10,10 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class Client(TestHelper): - def run(self, args): sys.stdout.write("testing imports... ") sys.stdout.flush() diff --git a/python/test/Slice/import/test.py b/python/test/Slice/import/test.py index c07a2a13df3..17484d3eb4c 100644 --- a/python/test/Slice/import/test.py +++ b/python/test/Slice/import/test.py @@ -2,10 +2,13 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -class SliceImportTestCase(ClientTestCase): +import os +import shutil +from Util import ClientTestCase, SliceTranslator, TestSuite - def setupClientSide(self, current): +class SliceImportTestCase(ClientTestCase): + def setupClientSide(self, current): testdir = current.testsuite.getPath() if os.path.exists(os.path.join(testdir, "Test1_ice.py")): os.remove(os.path.join(testdir, "Test1_ice.py")) diff --git a/python/test/Slice/macros/Client.py b/python/test/Slice/macros/Client.py index b8563d2de3d..34687766bfd 100755 --- a/python/test/Slice/macros/Client.py +++ b/python/test/Slice/macros/Client.py @@ -4,7 +4,8 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import sys import Ice import Test @@ -12,11 +13,10 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") class Client(TestHelper): - def run(self, args): sys.stdout.write("testing Slice predefined macros... ") sys.stdout.flush() diff --git a/python/test/Slice/structure/Client.py b/python/test/Slice/structure/Client.py index 4606be0b526..9baad9af0e5 100755 --- a/python/test/Slice/structure/Client.py +++ b/python/test/Slice/structure/Client.py @@ -4,7 +4,8 @@ # from TestHelper import TestHelper -TestHelper.loadSlice('Test.ice') + +TestHelper.loadSlice("Test.ice") import sys import copy import Test @@ -12,7 +13,7 @@ def test(b): if not b: - raise RuntimeError('test assertion failed') + raise RuntimeError("test assertion failed") def allTests(communicator): @@ -178,8 +179,6 @@ def allTests(communicator): class Client(TestHelper): - def run(self, args): - with self.initialize(args=args) as communicator: allTests(communicator) diff --git a/python/test/TestHelper.py b/python/test/TestHelper.py index 9e0eb9cfc92..53adaf4f911 100644 --- a/python/test/TestHelper.py +++ b/python/test/TestHelper.py @@ -10,51 +10,46 @@ class TestHelper: - def __init__(self): self._communicator = None def getTestEndpoint(self, properties=None, num=0, protocol=""): - if properties is None: properties = self._communicator.getProperties() if protocol == "": - protocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "default") + protocol = properties.getPropertyWithDefault( + "Ice.Default.Protocol", "default" + ) port = properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num return "{0} -p {1}".format(protocol, port) def getTestHost(self, properties=None): - if properties is None: properties = self._communicator.getProperties() return properties.getPropertyWithDefaul("Ice.Default.Host", "127.0.0.1") def getTestProtocol(self, properties=None): - if properties is None: properties = self._communicator.getProperties() return properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp") def getTestPort(self, properties=None, num=0): - if properties is None: properties = self._communicator.getProperties() return properties.getPropertyAsIntWithDefault("Test.BasePort", 12010) + num def createTestProperties(self, args=[]): - properties = Ice.createProperties(args) args = properties.parseCommandLineOptions("Test", args) return properties def initialize(self, initData=None, properties=None, args=[]): - if initData is None: initData = Ice.InitializationData() if properties: @@ -80,7 +75,7 @@ def shutdown(self): def loadSlice(self, args): sliceDir = Ice.getSliceDir() if not sliceDir: - print(sys.argv[0] + ': Slice directory not found.') + print(sys.argv[0] + ": Slice directory not found.") sys.exit(1) Ice.loadSlice("'-I{0}' {1}".format(sliceDir, args)) @@ -98,5 +93,5 @@ def run(self): return 1 -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(TestHelper.run())