mirror of https://github.com/zulip/zulip.git
mypy: Specify generic type parameters in cachify decorator.
Use of the decorator in event_queue.py suggests concrete return type, for application of copy() function.
This commit is contained in:
parent
94554c65da
commit
790cd5e7c8
|
@ -75,11 +75,11 @@ def asynchronous(method):
|
|||
return wrapper
|
||||
|
||||
def cachify(method):
|
||||
# type: (Callable) -> Callable
|
||||
dct = {} # type: Dict[Tuple, Any]
|
||||
# type: (Callable[..., ReturnT]) -> Callable[..., ReturnT]
|
||||
dct = {} # type: Dict[Tuple[Any, ...], ReturnT]
|
||||
|
||||
def cache_wrapper(*args):
|
||||
# type: (*Any) -> Any
|
||||
# type: (*Any) -> ReturnT
|
||||
tup = tuple(args)
|
||||
if tup in dct:
|
||||
return dct[tup]
|
||||
|
|
|
@ -805,7 +805,7 @@ def process_message_event(event_template, users):
|
|||
|
||||
@cachify
|
||||
def get_client_payload(apply_markdown, client_gravatar):
|
||||
# type: (bool, bool) -> Mapping[str, Any]
|
||||
# type: (bool, bool) -> Dict[str, Any]
|
||||
dct = copy.deepcopy(wide_dict)
|
||||
MessageDict.finalize_payload(dct, apply_markdown, client_gravatar)
|
||||
return dct
|
||||
|
|
Loading…
Reference in New Issue