import dascore as dc
from dascore.utils.patch import check_kind
patch = dc.get_example_patch()
assert check_kind(patch, patch.pass_filter(time=(None, 10)))
other = patch.update_attrs(tag="other")
assert not check_kind(patch, other, check_behavior="ignore")
# An unset attribute matches any value.
assert check_kind(patch, patch.update_attrs(acquisition_key="A.B.C.D"))check_kind
check_kind(
patch1 ,
patch2 ,
check_behavior: Literal[‘warn’, ‘raise’, ‘ignore’] = raise,
)-> ‘bool’
Return True if two patches are the same kind.
Kind is decided by the attributes named in the config option patch_kind_attrs and nothing else: coordinates, units, history, and the remaining attributes never enter. Two patches are the same kind unless they hold conflicting values for one of these attributes; a missing or empty value conflicts with nothing. Patches of different kinds are never combined, whatever their coordinates.
Parameters
| Parameter | Description |
|---|---|
| patch1 | The first patch. |
| patch2 | The second patch. |
| check_behavior |
What to do when the kinds differ: ‘raise’ (default) raisesIncompatiblePatchError,‘warn’ warns and returns False, ‘ignore’ returns False quietly. |