2016-11-27 06:14:48 +01:00
|
|
|
|
2017-03-03 19:01:52 +01:00
|
|
|
from typing import Any, Dict, Optional
|
2016-11-27 06:14:48 +01:00
|
|
|
|
2016-11-30 21:45:02 +01:00
|
|
|
if False:
|
|
|
|
import zerver.tornado.event_queue
|
2016-11-27 06:14:48 +01:00
|
|
|
|
2017-05-07 20:04:12 +02:00
|
|
|
descriptors_by_handler_id = {} # type: Dict[int, zerver.tornado.event_queue.ClientDescriptor]
|
2016-11-27 06:14:48 +01:00
|
|
|
|
|
|
|
def get_descriptor_by_handler_id(handler_id):
|
2016-11-27 06:56:06 +01:00
|
|
|
# type: (int) -> zerver.tornado.event_queue.ClientDescriptor
|
2016-11-27 06:14:48 +01:00
|
|
|
return descriptors_by_handler_id.get(handler_id)
|
|
|
|
|
|
|
|
def set_descriptor_by_handler_id(handler_id, client_descriptor):
|
2016-11-27 06:56:06 +01:00
|
|
|
# type: (int, zerver.tornado.event_queue.ClientDescriptor) -> None
|
2016-11-27 06:14:48 +01:00
|
|
|
descriptors_by_handler_id[handler_id] = client_descriptor
|
|
|
|
|
|
|
|
def clear_descriptor_by_handler_id(handler_id, client_descriptor):
|
2016-11-27 06:56:06 +01:00
|
|
|
# type: (int, Optional[zerver.tornado.event_queue.ClientDescriptor]) -> None
|
2016-11-27 06:14:48 +01:00
|
|
|
del descriptors_by_handler_id[handler_id]
|