From: Isaku Yamahata Date: Wed, 17 Oct 2012 18:18:16 +0000 (+0900) Subject: stream.py: un-decorator Stream.register_method X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7b7ee9753cd75da86c21ac6364dab07e5e8d51a;p=openvswitch stream.py: un-decorator Stream.register_method c38f8724aeb994fd840fa4283a07e38c3c114d68 made stream.py not use class decorator. So Stream.register need not to be decorator any more. So simplify it. Signed-off-by: Isaku Yamahata Signed-off-by: Ben Pfaff --- diff --git a/python/ovs/stream.py b/python/ovs/stream.py index 6bd0ccbe..dad68483 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -54,11 +54,8 @@ class Stream(object): _SOCKET_METHODS = {} @staticmethod - def register_method(method): - def _register_method(cls): - Stream._SOCKET_METHODS[method + ":"] = cls - return cls - return _register_method + def register_method(method, cls): + Stream._SOCKET_METHODS[method + ":"] = cls @staticmethod def _find_method(name): @@ -350,7 +347,7 @@ class UnixStream(Stream): connect_path = suffix return ovs.socket_util.make_unix_socket(socket.SOCK_STREAM, True, None, connect_path) -UnixStream = Stream.register_method("unix")(UnixStream) +Stream.register_method("unix", UnixStream) class TCPStream(Stream): @@ -361,4 +358,4 @@ class TCPStream(Stream): if not error: sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) return error, sock -TCPStream = Stream.register_method("tcp")(TCPStream) +Stream.register_method("tcp", TCPStream)