mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-30 09:40:35 +02:00
* WIP rebased * style * WIP, testing theory * fix type issue * fixed filtering bug * fix silliness * correct serialization and validation of threadsafedict * concurrent drive access * nits * nit * oauth bug fix * testing fix * fix slim retrieval * fix integration tests * fix testing change * CW comments * nit * guarantee completion stage existence * fix default values
14 lines
269 B
Python
14 lines
269 B
Python
from collections.abc import Callable
|
|
from functools import lru_cache
|
|
from typing import TypeVar
|
|
|
|
R = TypeVar("R")
|
|
|
|
|
|
def lazy_eval(func: Callable[[], R]) -> Callable[[], R]:
|
|
@lru_cache(maxsize=1)
|
|
def lazy_func() -> R:
|
|
return func()
|
|
|
|
return lazy_func
|