DSPy: The framework for programming—not prompting—language models
Python
Allow no-op decorator to take arguments
Guy Aglionbyd62ca70e3028
diff --git a/dsp/modules/cache_utils.py b/dsp/modules/cache_utils.pyindex a5c36c9f9..78270c879 100644--- a/dsp/modules/cache_utils.py+++ b/dsp/modules/cache_utils.py@@ -10,11 +10,18 @@ from dsp.utils import dotdictcache_turn_on = True-def noop_decorator(func):- @wraps(func)- def wrapper(*args, **kwargs):- return func(*args, **kwargs)- return wrapper+def noop_decorator(arg=None, *noop_args, **noop_kwargs):+ def decorator(func):+ @wraps(func)+ def wrapper(*args, **kwargs):+ return func(*args, **kwargs)++ return wrapper++ if callable(arg):+ return decorator(arg)+ else:+ return decoratorcachedir = os.environ.get('DSP_CACHEDIR') or os.path.join(Path.home(), 'cachedir_joblib')