File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11import re
22import time
3- from concurrent .futures import ThreadPoolExecutor , TimeoutError
3+ from concurrent .futures import Future , ThreadPoolExecutor , TimeoutError
44from datetime import datetime
55from functools import lru_cache
6- from typing import TypedDict
6+ from typing import TypedDict , TypeVar
77
88from flask import Flask , abort , render_template , request
99
@@ -123,7 +123,14 @@ def mmdd_filter(date_str: str) -> str:
123123 return date_str
124124
125125
126- def get_future_result_with_timeout (future , default_value , timeout = INDEX_FUTURE_TIMEOUT ):
126+ T = TypeVar ('T' )
127+
128+
129+ def get_future_result_with_timeout (
130+ future : Future [T ],
131+ default_value : T ,
132+ timeout : int = INDEX_FUTURE_TIMEOUT
133+ ) -> T :
127134 """
128135 Get result from a future with a timeout, returning a default value on timeout.
129136
You can’t perform that action at this time.
0 commit comments