doctor: better quick option propogation for stats (#239)
doctor: better quick option propogation for stats * use contextmanager for quick stats instead of editing global state directly * send quick to lots of stat related functions, so they could possibly be used without doctor, if someone wanted to * if a stats function has a 'quick' kwarg, send the value there as well * add an option to sort locations in my.time.tz.via_location
This commit is contained in:
parent
f43eedd52a
commit
0ce44bf0d1
7 changed files with 60 additions and 17 deletions
|
@ -13,12 +13,12 @@ from .common import StatsFun, Stats, stat
|
|||
|
||||
# TODO maybe could be enough to annotate OUTPUTS or something like that?
|
||||
# then stats could just use them as hints?
|
||||
def guess_stats(module_name: str) -> Optional[StatsFun]:
|
||||
def guess_stats(module_name: str, quick: bool=False) -> Optional[StatsFun]:
|
||||
providers = guess_data_providers(module_name)
|
||||
if len(providers) == 0:
|
||||
return None
|
||||
def auto_stats() -> Stats:
|
||||
return {k: stat(v) for k, v in providers.items()}
|
||||
return {k: stat(v, quick=quick) for k, v in providers.items()}
|
||||
return auto_stats
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue