From 3164a760a15b8b7035d819e9564a520ab1526c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Bokros?= Date: Sun, 3 Dec 2017 19:35:28 +0100 Subject: [PATCH] Remove unnecessary partial magic from EventHandler --- src/event_handlers/event_handler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/event_handlers/event_handler.py b/src/event_handlers/event_handler.py index 2e7b170..8db5d64 100644 --- a/src/event_handlers/event_handler.py +++ b/src/event_handlers/event_handler.py @@ -1,5 +1,4 @@ import json -from functools import partial from event_handler_base import EventHandlerBase @@ -9,11 +8,11 @@ class EventHandler(EventHandlerBase): super().__init__(anchor, zmq_context) self.event_handler_function = event_handler_function - def event_handler_callback(msg_parts, handler_func): + def event_handler_callback(msg_parts): anchor, message = msg_parts data_json = json.loads(message) - response = handler_func(data_json, self) + response = self.event_handler_function(data_json, self) encoded_response = json.dumps(response).encode('utf-8') self.zmq_push_socket.send_multipart([anchor, encoded_response]) - self.zmq_sub_stream.on_recv(partial(event_handler_callback, handler_func=event_handler_function)) + self.zmq_sub_stream.on_recv(event_handler_callback)