File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -74,13 +74,20 @@ async def dump_unpublished_modules(module_class: type[T], newer: list[T]) -> Non
7474 )
7575
7676
77- async def load_unpublished_modules (module_class : type [T ]) -> list [T ]:
78- module_name : str = module_class .__module_name__
77+ if TYPE_CHECKING :
7978
80- if (path_historical := CACHE_DIR / f"{ module_name } _unpublished.json" ).is_file ():
81- async with await anyio .open_file (path_historical ) as fhistorical :
82- return type_validate_json (list [module_class ], await fhistorical .read ())
83- return []
79+ async def load_unpublished_modules (module_class : type [T ]) -> list [T ]: ...
80+
81+ else :
82+
83+ @cache (ttl = None )
84+ async def load_unpublished_modules (module_class : type [T ]) -> list [T ]:
85+ module_name : str = module_class .__module_name__
86+
87+ if (path_historical := CACHE_DIR / f"{ module_name } _unpublished.json" ).is_file ():
88+ async with await anyio .open_file (path_historical ) as fhistorical :
89+ return type_validate_json (list [module_class ], await fhistorical .read ())
90+ return []
8491
8592
8693if TYPE_CHECKING :
You can’t perform that action at this time.
0 commit comments