Skip to content

Commit

Permalink
fix PatchType and SpoolType type var (#458)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-chambers authored Nov 8, 2024
1 parent aa0f62d commit ad2ecb5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dascore/utils/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions scripts/_render_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ad2ecb5

Please sign in to comment.