Skip to content

Commit

Permalink
fix PatchType and SpoolType type var
Browse files Browse the repository at this point in the history
  • Loading branch information
d-chambers committed Nov 8, 2024
1 parent aa0f62d commit c26966c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dascore/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import numpy as np
import pandas as pd

import dascore as dc
import dascore

PatchType = TypeVar("PatchType", bound="dc.Patch")
PatchType = TypeVar("PatchType", bound="dascore.Patch")

SpoolType = TypeVar("SpoolType", bound="dc.BaseSpool")
SpoolType = TypeVar("SpoolType", bound="dascore.BaseSpool")


@runtime_checkable
Expand Down
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`), you may need to import
dascore (not import dascore as dc) in the same file the patch function
is defined.
"""

def _wrapper(func):
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils/test_patch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pytest
from pydantic import Field

import dascore # noqa needed for PatchType
import dascore as dc
from dascore import patch_function
from dascore.constants import PatchType
Expand Down

0 comments on commit c26966c

Please sign in to comment.