diff --git a/dascore/utils/patch.py b/dascore/utils/patch.py index e10a5b43..59b6173c 100644 --- a/dascore/utils/patch.py +++ b/dascore/utils/patch.py @@ -234,9 +234,14 @@ def patch_function( Notes ----- - The original function can still be accessed with the raw_function - attribute. This may be useful for avoiding calling the patch_func - machinery multiple times from within another patch function. + - The original function can still be accessed with the raw_function + attribute. This may be useful for avoiding calling the patch_func + machinery multiple times from within another patch function. + + - If using `PatchType` or `SpoolType` type variables from the + [constants module](`dascore.constants`), make sure dascore is imported + as dc at the top of the file where the patch function is defined so + the forward refs can be resolved properly for type checking. """ def _wrapper(func): diff --git a/scripts/_render_api.py b/scripts/_render_api.py index 9617606f..20299e19 100644 --- a/scripts/_render_api.py +++ b/scripts/_render_api.py @@ -93,6 +93,9 @@ def unpact_annotation(obj, data_dict, address_dict) -> str: # just assume the bound string is resolvable key = str(obj).split("('")[-1].replace("')", "") name = key.split(".")[-1] + # dc. is the same as dascore. + if key.startswith("dc."): + key = f"dascore.{key[3:]}" return f"[{name}](`{key}`)" # Array-like thing from numpy #TODO improve this elif "numpy.typing" in str_rep: