Files
zulip/zerver/tornado/descriptors.py
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00

18 lines
704 B
Python

from typing import TYPE_CHECKING, Dict, Optional
if TYPE_CHECKING:
from zerver.tornado.event_queue import ClientDescriptor
descriptors_by_handler_id: Dict[int, "ClientDescriptor"] = {}
def get_descriptor_by_handler_id(handler_id: int) -> Optional['ClientDescriptor']:
return descriptors_by_handler_id.get(handler_id)
def set_descriptor_by_handler_id(handler_id: int,
client_descriptor: 'ClientDescriptor') -> None:
descriptors_by_handler_id[handler_id] = client_descriptor
def clear_descriptor_by_handler_id(handler_id: int,
client_descriptor: 'ClientDescriptor') -> None:
del descriptors_by_handler_id[handler_id]